diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000..ddcc32b --- /dev/null +++ b/.cspell.json @@ -0,0 +1,60 @@ +{ + "words": [ + "amannn", + "appdir", + "argcomplete", + "bierner", + "blockinfile", + "bpruitt", + "ccache", + "charliermarsh", + "containerd", + "customizer", + "cyclonedds", + "danielrichter", + "dconf", + "dotenvx", + "exfatprogs", + "fcitx", + "fdisk", + "flameshot", + "gparted", + "hardinfo", + "hwclock", + "insertafter", + "isort", + "jorgebucaran", + "keeweb", + "keymap", + "keyrings", + "kolourpaint", + "libfuse", + "libxcb", + "lichtblick", + "lineinfile", + "localectl", + "logind", + "mozc", + "ncdu", + "nemo", + "nsswitch", + "orbstack", + "pipx", + "pytest", + "rerunfailures", + "rustup", + "shellcheck", + "shellenv", + "shfmt", + "SHLVL", + "sqlitebrowser", + "usbubuntu", + "usbuntu", + "vcstool", + "venv", + "winbind", + "XMODIFIERS", + "xset", + "zstd" + ] +} diff --git a/.editorconfig b/.editorconfig index 0c6749c..3ed1eed 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,9 +4,12 @@ root = true charset = utf-8 end_of_line = lf indent_style = space -indent_size = 4 -trim_trailing_whitespace = true +indent_size = 2 insert_final_newline = true +trim_trailing_whitespace = true -[*.yml] -indent_size = 2 +[*.md] +trim_trailing_whitespace = false + +[*.py] +indent_size = 4 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..72a2d2e --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +## Types of PR + +- [ ] New Features +- [ ] Upgrade of existing features +- [ ] Bugfix + +## Description + +## How to review this PR + +All required checks by github actions have been passed. + +## Others diff --git a/.github/workflows/lint-pull-request.yaml b/.github/workflows/lint-pull-request.yaml new file mode 100644 index 0000000..695c8d3 --- /dev/null +++ b/.github/workflows/lint-pull-request.yaml @@ -0,0 +1,16 @@ +name: lint-pull-request + +on: + pull_request_target: + types: + - opened + - edited + - synchronize + +jobs: + lint-pull-request: + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 0000000..cc708fc --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,19 @@ +name: pre-commit + +on: + pull_request: + workflow_dispatch: + +jobs: + pre-commit: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/spell-check.yaml b/.github/workflows/spell-check.yaml new file mode 100644 index 0000000..84b60db --- /dev/null +++ b/.github/workflows/spell-check.yaml @@ -0,0 +1,14 @@ +name: spell-check + +on: + pull_request: + workflow_dispatch: + +jobs: + spell-check: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run spell-check + uses: streetsidesoftware/cspell-action@v6 diff --git a/.gitignore b/.gitignore index 1d74e21..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -.vscode/ diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..babaaa1 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,11 @@ +# See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules. +default: true +MD013: false +MD024: + siblings_only: true +MD029: + style: ordered +MD033: false +MD041: false +MD046: false +MD049: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..e5c95cf --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,52 @@ +ci: + autofix_commit_msg: "style(pre-commit): autofix" + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-xml + - id: check-yaml + args: [--unsafe] + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.43.0 + hooks: + - id: markdownlint + args: [-c, .markdownlint.yaml, --fix] + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + + - repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint + + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.10.0.1 + hooks: + - id: shellcheck + + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.10.0-2 + hooks: + - id: shfmt + args: [-w, -s, -i=4] + + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.0 # Match the version used by the vscode extension. Otherwise, the editor and the command may say different things. + hooks: + - id: ruff + args: [--fix] + - id: ruff-format diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..f4bd9e6 --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1 @@ +disable=SC1071 diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..499e5b4 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + "recommendations": [ + "charliermarsh.ruff", + "bierner.markdown-mermaid", + "bpruitt-goddard.mermaid-markdown-syntax-highlighting" + ], + "unwantedRecommendations": [ + "ms-python.isort", + "ms-python.black-formatter", + "ms-python.flake8" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..47bfbdc --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,29 @@ +{ + "cSpell.languageSettings": [ + { + "languageId": "c,cpp,python", + "allowCompoundWords": false + } + ], + "editor.formatOnSave": false, + "[python]": { + "editor.tabSize": 4, + "editor.formatOnType": true, + "editor.formatOnPaste": false, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit", + "source.organizeImports.ruff": "explicit" + }, + "editor.defaultFormatter": "charliermarsh.ruff" + }, + "python.autoComplete.extraPaths": [ + "${workspaceFolder}/.venv/lib/**/site-packages/", + "${workspaceFolder}/projects/**/src/" + ], + "python.analysis.extraPaths": [ + "${workspaceFolder}/.venv/lib/**/site-packages/", + "${workspaceFolder}/projects/**/src/" + ] +} diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..2c7bd08 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,22 @@ +extends: default + +ignore: | + *.param.yaml + +rules: + braces: + level: error + max-spaces-inside: 1 # To format with Prettier + comments: + level: error + min-spaces-from-content: 1 # To be compatible with C++ and Python + document-start: + level: error + present: false # Don't need document start markers + line-length: disable # Delegate to Prettier + truthy: + level: error + check-keys: false # To allow 'on' of GitHub Actions + quoted-strings: + level: error + required: only-when-needed # To keep consistent style diff --git a/ansible/mac.yml b/ansible/mac.yml index 8298340..54fbf83 100644 --- a/ansible/mac.yml +++ b/ansible/mac.yml @@ -1,4 +1,3 @@ ---- - name: setup local machine hosts: localhost connection: local diff --git a/ansible/roles/browser/tasks/main.yml b/ansible/roles/browser/tasks/main.yml index bcdfd91..9765521 100644 --- a/ansible/roles/browser/tasks/main.yml +++ b/ansible/roles/browser/tasks/main.yml @@ -1,19 +1,17 @@ - - name: brave apt key - become: yes + become: true block: - ansible.builtin.get_url: url: https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg dest: /usr/share/keyrings/brave-browser-archive-keyring.gpg - ansible.builtin.apt_repository: - repo: "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main" + repo: deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main state: present - - name: install brave using apt - become: yes + become: true ansible.builtin.apt: name: - brave-browser - update_cache: yes \ No newline at end of file + update_cache: true diff --git a/ansible/roles/desktop/tasks/main.yml b/ansible/roles/desktop/tasks/main.yml index 75e4472..caefc27 100644 --- a/ansible/roles/desktop/tasks/main.yml +++ b/ansible/roles/desktop/tasks/main.yml @@ -1,6 +1,5 @@ ---- - name: install desktop tools using apt - become: yes + become: true ansible.builtin.apt: name: - cinnamon-desktop-environment @@ -8,86 +7,92 @@ - exfatprogs - gparted - hardinfo - - "linux-generic-hwe-{{ ansible_facts['distribution_version'] }}" + - linux-generic-hwe-{{ ansible_facts['distribution_version'] }} - meld - thunderbird-locale-ja - winbind - zstd - update_cache: yes + update_cache: true - name: add grub-customizer ppa - become: yes + become: true ansible.builtin.apt_repository: repo: ppa:danielrichter2007/grub-customizer state: present - name: install grub-customizer - become: yes + become: true ansible.builtin.apt: name: grub-customizer - update_cache: yes + update_cache: true - name: set cinnamon env default terminal community.general.dconf: - key: "/org/cinnamon/desktop/applications/terminal/exec" - value: "'terminator'" + 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: "''" + key: /org/cinnamon/desktop/wm/preferences/mouse-button-modifier + value: state: present - name: set cinnamon env key customize (2/2) community.general.dconf: - key: "/org/cinnamon/desktop/wm/preferences/mouse-button-zoom-modifier" - value: "''" + key: /org/cinnamon/desktop/wm/preferences/mouse-button-zoom-modifier + value: 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']" + 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: yes + become: true ansible.builtin.lineinfile: path: /etc/systemd/logind.conf - line: "HandleLidSwitch=ignore" + line: HandleLidSwitch=ignore insertafter: EOF - name: set clock local for Windows dual boot system - become: yes + become: true community.general.timezone: name: Asia/Tokyo hwclock: local - name: setting for winbind - become: yes + become: true ansible.builtin.replace: path: /etc/nsswitch.conf regexp: " dns$" replace: " dns wins" - name: add chrome apt key - become: yes + become: true ansible.builtin.apt_key: url: https://dl-ssl.google.com/linux/linux_signing_key.pub state: present - name: add chrome apt repository - become: yes + become: true ansible.builtin.apt_repository: - repo: "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" - filename: "google-chrome" + repo: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main + filename: google-chrome state: present - name: install google-chrome - become: yes + become: true ansible.builtin.apt: name: google-chrome-stable - update_cache: yes + update_cache: true - import_tasks: multimedia.yml diff --git a/ansible/roles/desktop/tasks/multimedia.yml b/ansible/roles/desktop/tasks/multimedia.yml index 6c7d465..2d353a1 100644 --- a/ansible/roles/desktop/tasks/multimedia.yml +++ b/ansible/roles/desktop/tasks/multimedia.yml @@ -1,6 +1,5 @@ ---- - name: install multimedia applications using apt - become: yes + become: true ansible.builtin.apt: name: - flameshot @@ -8,4 +7,4 @@ - libxcb-cursor0 # calibre dependency - obs-studio - vlc - update_cache: yes + update_cache: true diff --git a/ansible/roles/dev_desktop/tasks/docker.yml b/ansible/roles/dev_desktop/tasks/docker.yml index c73f2a2..6e754e8 100644 --- a/ansible/roles/dev_desktop/tasks/docker.yml +++ b/ansible/roles/dev_desktop/tasks/docker.yml @@ -1,6 +1,5 @@ ---- - name: install docker build dependencies - become: yes + become: true ansible.builtin.apt: name: - apt-transport-https @@ -8,32 +7,32 @@ - curl - gnupg - lsb-release - update_cache: yes + update_cache: true - name: add docker apt key - become: yes + become: true ansible.builtin.apt_key: - url: 'https://download.docker.com/linux/ubuntu/gpg' + url: https://download.docker.com/linux/ubuntu/gpg state: present - name: add docker repository - become: yes + become: true ansible.builtin.apt_repository: - repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_facts['distribution_release'] }} stable" + repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_facts['distribution_release'] }} stable - name: install docker - become: yes + become: true ansible.builtin.apt: name: - docker-ce - docker-ce-cli - containerd.io - docker-compose-plugin - update_cache: yes + update_cache: true - name: add {{ ansible_facts['user_id'] }} to docker group - become: yes + become: true ansible.builtin.user: name: "{{ ansible_facts['user_id'] }}" groups: docker - append: yes + append: true diff --git a/ansible/roles/dev_desktop/tasks/main.yml b/ansible/roles/dev_desktop/tasks/main.yml index 9925179..d181c63 100644 --- a/ansible/roles/dev_desktop/tasks/main.yml +++ b/ansible/roles/dev_desktop/tasks/main.yml @@ -1,3 +1,2 @@ ---- - import_tasks: vscode.yml # - import_tasks: docker.yml diff --git a/ansible/roles/dev_desktop/tasks/podman.yml b/ansible/roles/dev_desktop/tasks/podman.yml index 2ae6bd0..ee0ebbd 100644 --- a/ansible/roles/dev_desktop/tasks/podman.yml +++ b/ansible/roles/dev_desktop/tasks/podman.yml @@ -1,6 +1,6 @@ - name: install podman - become: yes + become: true ansible.builtin.apt: name: - podman - update_cache: yes + update_cache: true diff --git a/ansible/roles/dev_desktop/tasks/vscode.yml b/ansible/roles/dev_desktop/tasks/vscode.yml index e24991a..0fccb88 100644 --- a/ansible/roles/dev_desktop/tasks/vscode.yml +++ b/ansible/roles/dev_desktop/tasks/vscode.yml @@ -1,26 +1,25 @@ ---- - name: add vscode key - become: yes + become: true ansible.builtin.apt_key: - url: 'https://packages.microsoft.com/keys/microsoft.asc' + url: https://packages.microsoft.com/keys/microsoft.asc state: present - name: add VS Code repo - become: yes + become: true ansible.builtin.apt_repository: - repo: "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" + repo: deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main filename: vscode state: present - name: install vscode dependencies - become: yes + become: true ansible.builtin.apt: name: - apt-transport-https state: present - name: install VS Code - become: yes + become: true ansible.builtin.apt: name: code state: present diff --git a/ansible/roles/development/tasks/main.yml b/ansible/roles/development/tasks/main.yml index 4106a5f..4ad7281 100644 --- a/ansible/roles/development/tasks/main.yml +++ b/ansible/roles/development/tasks/main.yml @@ -1,6 +1,5 @@ ---- - name: install develop tools - become: yes + become: true ansible.builtin.apt: name: - cmake @@ -8,20 +7,20 @@ - sqlitebrowser - upx - ccache - update_cache: yes + update_cache: true - import_tasks: python.yml - import_tasks: rust.yml - import_tasks: ros.yml - name: copy cyclonedds.conf for ros2 - become: yes + become: true ansible.builtin.copy: src: 60_cyclonedds.conf dest: /etc/sysctl.d/60_cyclonedds.conf - name: change ifconfig permission - become: yes + become: true ansible.builtin.file: path: /usr/sbin/ifconfig mode: 04755 diff --git a/ansible/roles/development/tasks/python.yml b/ansible/roles/development/tasks/python.yml index b44e33d..f7cb5b3 100644 --- a/ansible/roles/development/tasks/python.yml +++ b/ansible/roles/development/tasks/python.yml @@ -1,6 +1,5 @@ ---- - name: python3 packages - become: yes + become: true ansible.builtin.apt: name: - python3-pip @@ -8,4 +7,4 @@ - python3-pytest - python3-pytest-repeat - python3-pytest-rerunfailures - update_cache: yes + update_cache: true diff --git a/ansible/roles/development/tasks/ros.yml b/ansible/roles/development/tasks/ros.yml index c5e547b..c779586 100644 --- a/ansible/roles/development/tasks/ros.yml +++ b/ansible/roles/development/tasks/ros.yml @@ -4,6 +4,6 @@ dest: /tmp/lichtblick.deb - name: Install lichtblick deb package - become: yes + become: true ansible.builtin.apt: deb: /tmp/lichtblick.deb diff --git a/ansible/roles/development/tasks/rust.yml b/ansible/roles/development/tasks/rust.yml index 8243df2..5b9c19b 100644 --- a/ansible/roles/development/tasks/rust.yml +++ b/ansible/roles/development/tasks/rust.yml @@ -1,16 +1,15 @@ ---- - name: check if cargo is installed ansible.builtin.shell: command -v cargo register: cargo_exists - ignore_errors: yes + ignore_errors: true - name: Download Installer when: cargo_exists is failed ansible.builtin.get_url: url: https://sh.rustup.rs dest: /tmp/sh.rustup.rs - mode: '0755' - force: 'yes' + mode: "0755" + force: "yes" tags: - rust diff --git a/ansible/roles/dotfiles/tasks/main.yml b/ansible/roles/dotfiles/tasks/main.yml index 73bf2dd..155db12 100644 --- a/ansible/roles/dotfiles/tasks/main.yml +++ b/ansible/roles/dotfiles/tasks/main.yml @@ -1,10 +1,9 @@ ---- - name: install git latest - become: yes + become: true ansible.builtin.apt: name: git - update_cache: yes - when: "ansible_facts['distribution'] == 'Ubuntu'" + update_cache: true + when: ansible_facts['distribution'] == 'Ubuntu' - name: clone dotfiles ansible.builtin.git: @@ -13,10 +12,10 @@ - name: create .ssh directory ansible.builtin.file: - path: "~/.ssh" + path: ~/.ssh state: directory - name: copy known_hosts ansible.builtin.copy: - src: known_hosts - dest: ~/.ssh + src: known_hosts + dest: ~/.ssh diff --git a/ansible/roles/japanese/tasks/main.yml b/ansible/roles/japanese/tasks/main.yml index 7ddfa60..7407f64 100644 --- a/ansible/roles/japanese/tasks/main.yml +++ b/ansible/roles/japanese/tasks/main.yml @@ -1,35 +1,35 @@ - name: Add Ubuntu Japanese PPA keyring - become: yes + become: true ansible.builtin.apt_key: url: https://www.ubuntulinux.jp/ubuntu-jp-ppa-keyring.gpg state: present - when: "ansible_facts['distribution_release'] == 'jammy'" + when: ansible_facts['distribution_release'] == 'jammy' - name: Add Ubuntu Japanese archive keyring - become: yes + become: true ansible.builtin.apt_key: url: https://www.ubuntulinux.jp/ubuntu-ja-archive-keyring.gpg state: present - when: "ansible_facts['distribution_release'] == 'jammy'" + when: ansible_facts['distribution_release'] == 'jammy' - name: Download Ubuntu Japanese repository - become: yes + become: true ansible.builtin.get_url: - url: "https://www.ubuntulinux.jp/sources.list.d/jammy.list" + url: https://www.ubuntulinux.jp/sources.list.d/jammy.list dest: /etc/apt/sources.list.d/ubuntu-ja.list - when: "ansible_facts['distribution_release'] == 'jammy'" + when: ansible_facts['distribution_release'] == 'jammy' - name: Download Ubuntu Japanese repository - become: yes + become: true ansible.builtin.get_url: - url: "https://www.ubuntulinux.jp/sources.list.d/noble.sources" + url: https://www.ubuntulinux.jp/sources.list.d/noble.sources dest: /etc/apt/sources.list.d/ubuntu-ja.sources - when: "ansible_facts['distribution_release'] == 'noble'" + when: ansible_facts['distribution_release'] == 'noble' - name: install ja package - become: yes + become: true ansible.builtin.apt: name: - ubuntu-defaults-ja - language-pack-ja - update_cache: yes + update_cache: true diff --git a/ansible/roles/mac/tasks/main.yml b/ansible/roles/mac/tasks/main.yml index 70915b1..3726f51 100644 --- a/ansible/roles/mac/tasks/main.yml +++ b/ansible/roles/mac/tasks/main.yml @@ -5,11 +5,11 @@ - name: update homebrew community.general.homebrew: - update_homebrew: yes + update_homebrew: true - name: brew install community.general.homebrew: - name: '{{ item }}' + name: "{{ item }}" state: present with_items: - fish @@ -29,9 +29,9 @@ - name: install homebrew cask packages community.general.homebrew_cask: - name: '{{ item }}' + name: "{{ item }}" state: present - install_options: 'appdir=/Applications' + install_options: appdir=/Applications with_items: - db-browser-for-sqlite - google-japanese-ime diff --git a/ansible/roles/remote/tasks/main.yml b/ansible/roles/remote/tasks/main.yml index a1a0294..b63e4c6 100644 --- a/ansible/roles/remote/tasks/main.yml +++ b/ansible/roles/remote/tasks/main.yml @@ -1,4 +1,3 @@ ---- - name: download chrome-remote-desktop deb ansible.builtin.get_url: # CRD 125 seems not working https://askubuntu.com/questions/1512423/chrome-remote-desktop-in-24-04 @@ -6,6 +5,6 @@ dest: /tmp/chrome-remote-desktop.deb - name: Install chrome-remote-desktop deb package - become: yes + become: true ansible.builtin.apt: deb: /tmp/chrome-remote-desktop.deb diff --git a/ansible/roles/remote/tasks/ssh-server.yml b/ansible/roles/remote/tasks/ssh-server.yml index 2257417..faeadaf 100644 --- a/ansible/roles/remote/tasks/ssh-server.yml +++ b/ansible/roles/remote/tasks/ssh-server.yml @@ -1,6 +1,5 @@ ---- - name: install openssh-server - become: yes + become: true ansible.builtin.apt: name: openssh-server @@ -8,38 +7,38 @@ ansible.builtin.file: path: ~/.ssh state: directory - mode: '700' + mode: "700" - name: update ssh settings (2/6) ansible.builtin.copy: src: authorized_keys dest: ~/.ssh/authorized_keys - mode: '600' + mode: "600" - name: update ssh settings (3/6) - become: yes + become: true ansible.builtin.replace: path: /etc/ssh/sshd_config - regexp: "^#Port 22" - replace: "Port {{ lookup('env', 'ssh_port') }}" + regexp: ^#Port 22 + replace: Port {{ lookup('env', 'ssh_port') }} - name: update ssh settings (4/6) - become: yes + become: true ansible.builtin.replace: path: /etc/ssh/sshd_config - regexp: "^#AuthorizedKeysFile" - replace: "AuthorizedKeysFile" + regexp: ^#AuthorizedKeysFile + replace: AuthorizedKeysFile - name: update ssh settings (5/6) - become: yes + become: true ansible.builtin.replace: path: /etc/ssh/sshd_config - regexp: "^#PasswordAuthentication yes" - replace: "PasswordAuthentication no" + regexp: ^#PasswordAuthentication yes + replace: PasswordAuthentication no - name: update ssh settings (6/6) - become: yes + become: true ansible.builtin.replace: path: /etc/ssh/sshd_config - regexp: "PermitRootLogin prohibit-password" - replace: "PermitRootLogin no" + regexp: PermitRootLogin prohibit-password + replace: PermitRootLogin no diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 7a7c9cd..e2e2dca 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -1,9 +1,8 @@ ---- - name: use English folder name ansible.builtin.shell: LANG=C xdg-user-dirs-update --force - name: install system tools using apt - become: yes + become: true ansible.builtin.apt: name: - htop @@ -14,19 +13,19 @@ - ripgrep - libfuse2 # https://syohex.hatenablog.com/entry/2022/05/02/230822 - tree - update_cache: yes + update_cache: true - name: add fish ppa - become: yes + become: true ansible.builtin.apt_repository: repo: ppa:fish-shell/release-3 state: present - name: install fish shell - become: yes + become: true ansible.builtin.apt: name: fish - update_cache: yes + update_cache: true - name: install fisher ansible.builtin.shell: curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher diff --git a/ansible/roles/wsl/tasks/main.yml b/ansible/roles/wsl/tasks/main.yml index 4d3545e..0205714 100644 --- a/ansible/roles/wsl/tasks/main.yml +++ b/ansible/roles/wsl/tasks/main.yml @@ -1,31 +1,30 @@ ---- - name: copy font conf - become: yes + become: true ansible.builtin.copy: src: local.conf dest: /etc/fonts/local.conf - name: Ensure a locale exists - become: yes + become: true community.general.locale_gen: name: ja_JP.UTF-8 state: present - name: keyboard setting - become: yes + become: true ansible.builtin.command: localectl set-x11-keymap jp jp106 - name: change locale - become: yes + become: true ansible.builtin.command: update-locale LANG=ja_JP.UTF-8 - name: install input method - become: yes + become: true ansible.builtin.apt: name: - fcitx-mozc - x11-xserver-utils - update_cache: yes + update_cache: true - name: input method setting ansible.builtin.blockinfile: @@ -41,8 +40,8 @@ fi - name: unzip - become: yes + become: true ansible.builtin.apt: name: - unzip - update_cache: yes + update_cache: true diff --git a/ansible/ubuntu.yml b/ansible/ubuntu.yml index 9cc2eee..3a0085c 100644 --- a/ansible/ubuntu.yml +++ b/ansible/ubuntu.yml @@ -1,4 +1,3 @@ ---- - name: setup local machine hosts: localhost connection: local @@ -9,7 +8,7 @@ - name: prompt_dev prompt: Is target environment for development? [y/N] private: false - default: "y" + default: y - name: prompt_remote prompt: Set up remote tools? [y/N] private: false @@ -27,4 +26,3 @@ when: prompt_dev == 'y' and prompt_wsl != 'y' - role: remote when: prompt_remote == 'y' - diff --git a/post_setup.sh b/post_setup.sh index 4ce9f03..d39324b 100755 --- a/post_setup.sh +++ b/post_setup.sh @@ -1,13 +1,13 @@ #!/bin/bash if [ -f "$HOME/.ssh/github_rsa" ]; then - bash $HOME/.dotfiles/install.sh + bash "$HOME/.dotfiles/install.sh" mise install -y else echo "$HOME/.ssh/github_rsa not found" fi -read -p "Do you want install python cli tools using uv? (y/n): " answer +read -p -r "Do you want install python cli tools using uv? (y/n): " answer if [ "$answer" == "y" ]; then uv tool install pre-commit @@ -17,4 +17,3 @@ if [ "$answer" == "y" ]; then else echo "cancel" fi - diff --git a/tips/backup.md b/tips/backup.md index 79fb4e6..70e72d1 100644 --- a/tips/backup.md +++ b/tips/backup.md @@ -13,29 +13,29 @@ 1. 準備の2で用意したメディアからブートする 2. バックアップするディスクの容量を縮める。(使用領域+2,3Gバイト程度に縮める) - - GPartedを起動して、バックアップするドライブ(ここではsdb)を開く - - ![gparted1](./pic/backup01.png) - - 使用済みの領域15G程度なので、17Gちょっとまで縮める - - ![gparted2](./pic/backup02.png) + - GPartedを起動して、バックアップするドライブ(ここではsdb)を開く + - ![gparted1](./pic/backup01.png) + - 使用済みの領域15G程度なので、17Gちょっとまで縮める + - ![gparted2](./pic/backup02.png) 3. 使用しているブロックサイズを確認する - - ターミナルを開いて、コマンドを叩くsudo fdisk -l /dev/sdb - -```shell -hyt@usbuntu:~$ sudo fdisk -l /dev/sdb -[sudo] hyt のパスワード: -ディスク /dev/sdb: 59.6 GiB, 64023257088 バイト, 125045424 セクタ -単位: セクタ (1 * 512 = 512 バイト) -セクタサイズ (論理 / 物理): 512 バイト / 512 バイト -I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト -ディスクラベルのタイプ: dos -ディスク識別子: 0x0002f2a2 - -デバイス 起動 開始位置 最後から セクタ サイズ Id タイプ -/dev/sdb1 2048 98303 96256 47M b W95 FAT32 -/dev/sdb2 * 98304 37083135 36984832 17.7G 83 Linux -``` -4. 縮めたパーティションのブロック+1までバックアップする + - ターミナルを開いて、コマンドを叩くsudo fdisk -l /dev/sdb + + ```shell + hyt@usbuntu:~$ sudo fdisk -l /dev/sdb + [sudo] hyt のパスワード: + ディスク /dev/sdb: 59.6 GiB, 64023257088 バイト, 125045424 セクタ + 単位: セクタ (1 * 512 = 512 バイト) + セクタサイズ (論理 / 物理): 512 バイト / 512 バイト + I/O サイズ (最小 / 推奨): 512 バイト / 512 バイト + ディスクラベルのタイプ: dos + ディスク識別子: 0x0002f2a2 -- この例では、コマンドを叩いてsdb2のブロックの終わりが37083135なので37083136までバックアップする -- sudo dd if=/dev/sdb of=usbubuntu.img bs=512 count=37083136 + デバイス 起動 開始位置 最後から セクタ サイズ Id タイプ + /dev/sdb1 2048 98303 96256 47M b W95 FAT32 + /dev/sdb2 * 98304 37083135 36984832 17.7G 83 Linux + ``` + +4. 縮めたパーティションのブロック+1までバックアップする + - この例では、コマンドを叩いてsdb2のブロックの終わりが37083135なので37083136までバックアップする + - sudo dd if=/dev/sdb of=usbubuntu.img bs=512 count=37083136