Skip to content

Commit

Permalink
Merge branch 'main' into feat/podman
Browse files Browse the repository at this point in the history
Signed-off-by: Hayato Mizushima <[email protected]>
  • Loading branch information
hayato-m126 committed Jan 19, 2025
2 parents 92c5cc7 + 0701b25 commit cf400a7
Show file tree
Hide file tree
Showing 21 changed files with 240 additions and 104 deletions.
22 changes: 22 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,36 @@
"amannn",
"appdir",
"argcomplete",
"armhf",
"autoclean",
"BFFD",
"bierner",
"blockinfile",
"bpruitt",
"ccache",
"cdimage",
"CEFE",
"CFEC",
"charliermarsh",
"containerd",
"cuda",
"customizer",
"cyclonedds",
"danielrichter",
"dconf",
"dearmour",
"dearmour",
"DONT",
"dotenvx",
"dpkg",
"exfatprogs",
"fcitx",
"fdisk",
"flameshot",
"fontconfig",
"ghostty",
"gparted",
"gpasswd",
"hardinfo",
"hwclock",
"insertafter",
Expand All @@ -28,7 +42,9 @@
"keymap",
"keyrings",
"kolourpaint",
"libcudnn",
"libfuse",
"libnv",
"libxcb",
"lichtblick",
"lineinfile",
Expand All @@ -37,22 +53,28 @@
"mozc",
"ncdu",
"nemo",
"nistp",
"nsswitch",
"orbstack",
"packagekitd",
"pipx",
"pytest",
"rerunfailures",
"rmem",
"rustup",
"shellcheck",
"shellenv",
"shfmt",
"SHLVL",
"Sonoma",
"sqlitebrowser",
"unhold",
"usbubuntu",
"usbuntu",
"vcstool",
"venv",
"winbind",
"wslg",
"XMODIFIERS",
"xset",
"zstd"
Expand Down
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ trim_trailing_whitespace = false

[*.py]
indent_size = 4

[*.sh]
indent_size = 4
2 changes: 0 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@

## How to review this PR

All required checks by github actions have been passed.

## Others
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

setup OS using ansible

## notice

aptに以下のようなwarningがある状態で実行するとprivilege output closed while waiting for password promptというようなよくわからないエラーが出ることがある。
先にaptの修正をする。

```shell
W: https://packages.microsoft.com/repos/vscode/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://archive.ubuntulinux.jp/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://archive.ubuntulinux.jp/ubuntu-ja-non-free/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: ターゲット Packages (main/binary-amd64/Packages) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット Packages (main/binary-all/Packages) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-ja_JP) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-ja) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット Translations (main/i18n/Translation-en) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット DEP-11 (main/dep11/Components-amd64.yml) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット DEP-11 (main/dep11/Components-all.yml) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット DEP-11-icons-small (main/dep11/icons-48x48.tar) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット DEP-11-icons (main/dep11/icons-64x64.tar) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット DEP-11-icons-hidpi (main/dep11/[email protected]) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット CNF (main/cnf/Commands-amd64) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
W: ターゲット CNF (main/cnf/Commands-all) は /etc/apt/sources.list.d/google-chrome.list:3 と /etc/apt/sources.list.d/google-chrome.list:4 で複数回設定されています
```

## Support OS

- Ubuntu 22.04 / 24.04 LTS
Expand All @@ -26,7 +49,7 @@ sudo apt install usb-creator-gtk
事前にgithub_rsaをコピーしておく

```shell
./setup-localhost.sh
./setup.sh
```

## known issue for 24.04
Expand Down
23 changes: 23 additions & 0 deletions ansible/roles/desktop/tasks/cinnamon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- name: set cinnamon env default terminal
community.general.dconf:
key: "/org/cinnamon/desktop/applications/terminal/exec" # yamllint disable-line rule:quoted-strings
value: "'terminator'" # yamllint disable-line rule:quoted-strings
state: present

- name: set cinnamon env key customize (1/2)
community.general.dconf:
key: "/org/cinnamon/desktop/wm/preferences/mouse-button-modifier" # yamllint disable-line rule:quoted-strings
value: "'<Super>'" # yamllint disable-line rule:quoted-strings
state: present

- name: set cinnamon env key customize (2/2)
community.general.dconf:
key: "/org/cinnamon/desktop/wm/preferences/mouse-button-zoom-modifier" # yamllint disable-line rule:quoted-strings
value: "'<Super>'" # yamllint disable-line rule:quoted-strings
state: present

- name: set start menu favorite
community.general.dconf:
key: "/org/cinnamon/favorite-apps" # yamllint disable-line rule:quoted-strings
value: "['firefox.desktop', 'cinnamon-settings.desktop', 'nemo.desktop', 'terminator.desktop']" # yamllint disable-line rule:quoted-strings
state: present
31 changes: 1 addition & 30 deletions ansible/roles/desktop/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,6 @@
name: grub-customizer
update_cache: true

- name: set cinnamon env default terminal
community.general.dconf:
key: /org/cinnamon/desktop/applications/terminal/exec
value: terminator
state: present

- name: set cinnamon env key customize (1/2)
community.general.dconf:
key: /org/cinnamon/desktop/wm/preferences/mouse-button-modifier
value: <Super>
state: present

- name: set cinnamon env key customize (2/2)
community.general.dconf:
key: /org/cinnamon/desktop/wm/preferences/mouse-button-zoom-modifier
value: <Super>
state: present

- name: set start menu favorite
community.general.dconf:
key: /org/cinnamon/favorite-apps
value:
[
firefox.desktop,
cinnamon-settings.desktop,
nemo.desktop,
terminator.desktop,
]
state: present

- name: disable sleep when close note pc display
become: true
ansible.builtin.lineinfile:
Expand Down Expand Up @@ -96,3 +66,4 @@
update_cache: true

- import_tasks: multimedia.yml
- import_tasks: cinnamon.yml
6 changes: 4 additions & 2 deletions ansible/roles/dev_desktop/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- import_tasks: vscode.yml
# - import_tasks: docker.yml
- import_tasks: podman
- import_tasks: docker.yml
when: ansible_facts['distribution_release'] == 'jammy'
- import_tasks: podman.yml
when: ansible_facts['distribution_release'] == 'noble'
7 changes: 0 additions & 7 deletions ansible/roles/dotfiles/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
- name: install git latest
become: true
ansible.builtin.apt:
name: git
update_cache: true
when: ansible_facts['distribution'] == 'Ubuntu'

- name: clone dotfiles
ansible.builtin.git:
repo: https://github.com/hayato-m126/dotfiles.git
Expand Down
3 changes: 3 additions & 0 deletions ansible/roles/mac/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
- podman-desktop
- thunderbird
- visual-studio-code
- ghostty
- arc
- discord
# - google-chrome

- name: install fisher
Expand Down
4 changes: 4 additions & 0 deletions ansible/roles/system/tasks/fish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: install fisher
ansible.builtin.shell: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
args:
executable: /bin/fish
18 changes: 3 additions & 15 deletions ansible/roles/system/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
- name: use English folder name
ansible.builtin.shell: LANG=C xdg-user-dirs-update --force

- name: install system tools using apt
become: true
ansible.builtin.apt:
Expand All @@ -27,15 +24,6 @@
name: fish
update_cache: true

- name: install fisher
ansible.builtin.shell: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
args:
executable: /bin/fish

- name: fisher update
ansible.builtin.shell: fisher update
args:
executable: /bin/fish

- name: install mise
ansible.builtin.shell: curl https://mise.jdx.dev/install.sh | sh
- import_tasks: fish.yml
- import_tasks: setting.yml
- import_tasks: mise.yml
2 changes: 2 additions & 0 deletions ansible/roles/system/tasks/mise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: install mise
ansible.builtin.shell: curl https://mise.jdx.dev/install.sh | sh
2 changes: 2 additions & 0 deletions ansible/roles/system/tasks/setting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: use English folder name
ansible.builtin.shell: LANG=C xdg-user-dirs-update --force
4 changes: 4 additions & 0 deletions ansible/roles/user/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- import_tasks: ../../desktop/tasks/cinnamon.yml
- import_tasks: ../../system/tasks/fish.yml
- import_tasks: ../../system/tasks/setting.yml
- import_tasks: ../../system/tasks/mise.yml
5 changes: 5 additions & 0 deletions ansible/user.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- name: setup normal user
hosts: localhost
connection: local
roles:
- role: user
4 changes: 2 additions & 2 deletions post_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ else
echo "$HOME/.ssh/github_rsa not found"
fi

read -p -r "Do you want install python cli tools using uv? (y/n): " answer
echo "Do you want install python cli tools using uv? (y/n)"
read -r answer

if [ "$answer" == "y" ]; then
uv tool install pre-commit
uv tool install argcomplete
uv tool install vcstool
uv tool install ruff
else
echo "cancel"
fi
17 changes: 0 additions & 17 deletions setup-mac.sh

This file was deleted.

36 changes: 36 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# export .env
set -o allexport
# shellcheck disable=SC1091
source "$(dirname "$0")/.env"
set +o allexport

PLAYBOOK="ansible/ubuntu.yml"

if [[ $OSTYPE == 'darwin'* ]]; then
PLAYBOOK="ansible/mac.yml"
if ! (command -v brew >/dev/null 2>&1); then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
elif [[ $OSTYPE == 'linux'* ]]; then
if ! (command -v curl >/dev/null 2>&1); then
sudo apt -y update
sudo apt -y install curl
fi
else
echo "This OS is not supported"
exit 1
fi

if ! (command -v uv >/dev/null 2>&1); then
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin"
fi
if ! (command -v ansible-playbook >/dev/null 2>&1); then
uv tool install ansible-core
ansible-galaxy collection install community.general
fi

ansible-playbook $PLAYBOOK --ask-become-pass
36 changes: 19 additions & 17 deletions tips/apt.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,31 +145,33 @@ pub dsa1024 2005-05-24 [SC]
uid [ 不明 ] Ubuntu-ja Archive Automatic Signing Key <[email protected]>
sub elg2048 2005-05-24 [E]

pub rsa1024 2013-08-21 [SC]
59FD A1CE 1B84 B3FA D893 66C0 2755 7F05 6DC3 3CA5
uid [ 不明 ] Launchpad PPA for Fish shell maintainers

pub rsa4096 2024-05-03 [SC]
8842 1E70 3EDC 7AF5 4967 DED4 73C9 FCC9 E2BB 48DA
uid [ 不明 ] Launchpad PPA for Fish shell maintainers

/etc/apt/trusted.gpg.d/ubuntu-keyring-2012-cdimage.gpg
------------------------------------------------------
pub rsa4096 2012-05-11 [SC]
8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092
uid [ 不明 ] Ubuntu CD Image Automatic Signing Key (2012) <[email protected]>
pub rsa4096 2024-05-02 [SC]
7EDB 2B9A EE07 57D7 87DF FC20 14BE BC73 63BD C51E
uid [ 不明 ] Launchpad PPA for Daniel Richter

pub dsa1024 2007-03-08 [SC]
4CCA 1EAF 950C EE4A B839 76DC A040 830F 7FAC 5991
uid [ 不明 ] Google, Inc. Linux Package Signing Key <[email protected]>
sub elg2048 2007-03-08 [E]

pub rsa2048 2015-10-28 [SC]
BC52 8686 B50D 79E3 39D3 721C EB3E 94AD BE12 29CF
uid [ 不明 ] Microsoft (Release signing) <[email protected]>

pub rsa4096 2017-02-22 [SCEA]
9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88
uid [ 不明 ] Docker Release (CE deb) <[email protected]>
sub rsa4096 2017-02-22 [S]

/etc/apt/trusted.gpg.d/ubuntu-keyring-2018-archive.gpg
------------------------------------------------------
pub rsa4096 2018-09-17 [SC]
F6EC B376 2474 EDA9 D21B 7022 8719 20D1 991B C93C
uid [ 不明 ] Ubuntu Archive Automatic Signing Key (2018) <[email protected]>

❯ sudo apt-key export 'CDC1D865' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/ubuntu-jp-team.gpg
❯ sudo apt-key export '0C4ECFEC' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/ubuntu-ja-archive.gpg
❯ sudo apt-key export '6DC33CA5' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/fish-shell-old.gpg
❯ sudo apt-key export 'E2BB48DA' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/fish-shell-new.gpg
❯ sudo apt-key export '3F055C03' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/grub-customizer.gpg
❯ sudo apt-key export 'E2BB48DA' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/fish-shell.gpg
❯ sudo apt-key export '63BDC51E' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/grub-customizer.gpg
❯ sudo apt-key export '0EBFCD88' | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/docker.gpg


Expand Down
Loading

0 comments on commit cf400a7

Please sign in to comment.