aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-31 23:44:54 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-31 23:44:54 +0200
commit727ab17a644d52105746e18c301cf733b1181507 (patch)
tree71113c6efae3074899de965aee5489cb76362f8e /roles
parentdowngrade Ansible (diff)
downloadmaintenance-727ab17a644d52105746e18c301cf733b1181507.tar.gz
maintenance-727ab17a644d52105746e18c301cf733b1181507.zip
move Ansible files to src/
Diffstat (limited to 'roles')
-rw-r--r--roles/apt/meta/main.yml3
-rw-r--r--roles/apt/tasks/main.yml19
-rw-r--r--roles/common/handlers/main.yml24
-rw-r--r--roles/common/tasks/main.yml17
-rw-r--r--roles/common/tasks/tool.yml8
-rw-r--r--roles/docker/tasks/main.yml3
-rw-r--r--roles/dotfiles/defaults/main.yml1
-rw-r--r--roles/dotfiles/tasks/main.yml27
-rw-r--r--roles/etckeeper/defaults/main.yml2
-rw-r--r--roles/etckeeper/tasks/main.yml16
-rw-r--r--roles/flatpak/tasks/main.yml3
-rw-r--r--roles/pacman/meta/main.yml4
-rw-r--r--roles/pacman/tasks/main.yml67
-rw-r--r--roles/rate_mirrors/meta/main.yml3
-rw-r--r--roles/rate_mirrors/tasks/main.yml45
-rw-r--r--roles/snap/meta/main.yml3
-rw-r--r--roles/snap/tasks/main.yml27
-rw-r--r--roles/vagrant/tasks/main.yml9
-rw-r--r--roles/yay/meta/main.yml3
-rw-r--r--roles/yay/tasks/main.yml16
20 files changed, 0 insertions, 300 deletions
diff --git a/roles/apt/meta/main.yml b/roles/apt/meta/main.yml
deleted file mode 100644
index 4516fa1..0000000
--- a/roles/apt/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-dependencies:
- - role: common
- - {role: etckeeper, when: etc_versioned}
diff --git a/roles/apt/tasks/main.yml b/roles/apt/tasks/main.yml
deleted file mode 100644
index 297307b..0000000
--- a/roles/apt/tasks/main.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-- name: Upgrade packages
- become: true
- ansible.builtin.apt:
- update_cache: true
- upgrade: full
- notify: reboot
-
-- name: Flush handlers
- ansible.builtin.meta: flush_handlers
-
-- name: Clean up dependencies
- become: true
- ansible.builtin.apt:
- autoremove: true
- purge: true
- notify: reboot
-
-- name: Flush handlers
- ansible.builtin.meta: flush_handlers
diff --git a/roles/common/handlers/main.yml b/roles/common/handlers/main.yml
deleted file mode 100644
index 4942957..0000000
--- a/roles/common/handlers/main.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-- name: Reboot
- ansible.builtin.reboot:
- args:
- # On my trusty old Raspberry Pi 1 Model B+, /proc/sys/kernel/random/boot_id
- # can sometimes stay the same between reboots. Apparently, not enough
- # entropy or something.
- boot_time_command: uptime -s
- # Another option is `who -s`. This option requires Ansible 2.10 or later.
-
- # 5 minutes is plenty.
- reboot_timeout: 300
- # Don't reboot yourself accidentally:
- when: 'ansible_env["SSH_CLIENT"].split()[0] not in ansible_all_ipv4_addresses'
- become: true
- listen: reboot
-
-- name: Wait for connectivity
- # One of the nodes is the VPN server connecting all the other nodes, wait
- # until all of them are back up:
- ansible.builtin.wait_for_connection:
- args:
- # 5 minutes is plenty.
- timeout: 300
- listen: reboot
diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml
deleted file mode 100644
index fb0eaed..0000000
--- a/roles/common/tasks/main.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-- name: Check available tools
- ansible.builtin.include_tasks: tool.yml
- loop:
- - apt
- - docker
- - flatpak
- - pacman
- - rate-mirrors
- - snap
- - vagrant
- - yay
-
-- name: Check if /etc is versioned
- become: true
- ansible.builtin.stat:
- path: /etc/.git/config
- register: etc_versioned
diff --git a/roles/common/tasks/tool.yml b/roles/common/tasks/tool.yml
deleted file mode 100644
index 48d0acc..0000000
--- a/roles/common/tasks/tool.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-- name: "Check for {{ item }}"
- ansible.builtin.command: "{{ item }} --version"
- register: cmd_result
- changed_when: false
- failed_when: false
-
-- name: "Set fact about {{ item }}"
- ansible.builtin.set_fact: "has_{{ item | replace('-', '_') }}={{ cmd_result.rc == 0 }}"
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
deleted file mode 100644
index 601dca2..0000000
--- a/roles/docker/tasks/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-- name: Clean up Docker data
- become: true
- ansible.builtin.command: docker system prune -a -f --volumes
diff --git a/roles/dotfiles/defaults/main.yml b/roles/dotfiles/defaults/main.yml
deleted file mode 100644
index 0ce4769..0000000
--- a/roles/dotfiles/defaults/main.yml
+++ /dev/null
@@ -1 +0,0 @@
-dotfiles_user: egor
diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml
deleted file mode 100644
index 4230aac..0000000
--- a/roles/dotfiles/tasks/main.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-- name: ssh-agent hack
- ansible.posix.acl:
- path: "{{ item }}"
- etype: user
- entity: "{{ dotfiles_user }}"
- permissions: rwx
- state: present
- loop:
- - "{{ ansible_env.SSH_AUTH_SOCK | dirname }}"
- - "{{ ansible_env.SSH_AUTH_SOCK }}"
-
-- name: Update my dotfiles
- become: true
- become_user: "{{ dotfiles_user }}"
- block:
- - name: Pull repositories
- ansible.builtin.git:
- accept_hostkey: true
- dest: "~/workspace/personal/{{ item }}"
- repo: "git@github.com:egor-tensin/{{ item }}.git"
- loop:
- - linux-home
-
- - name: Run setup.sh
- ansible.builtin.command: ./setup.sh
- args:
- chdir: ~/workspace/personal/linux-home
diff --git a/roles/etckeeper/defaults/main.yml b/roles/etckeeper/defaults/main.yml
deleted file mode 100644
index 077855f..0000000
--- a/roles/etckeeper/defaults/main.yml
+++ /dev/null
@@ -1,2 +0,0 @@
-git_name: Egor Tensin
-git_email: Egor.Tensin@gmail.com
diff --git a/roles/etckeeper/tasks/main.yml b/roles/etckeeper/tasks/main.yml
deleted file mode 100644
index 19f9b86..0000000
--- a/roles/etckeeper/tasks/main.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-- name: Make sure git is configured
- become: true
- block:
- - name: Set user.name
- community.general.git_config:
- scope: local
- repo: /etc
- name: user.name
- value: '{{ git_name }}'
-
- - name: Set user.email
- community.general.git_config:
- scope: local
- repo: /etc
- name: user.email
- value: '{{ git_email }}'
diff --git a/roles/flatpak/tasks/main.yml b/roles/flatpak/tasks/main.yml
deleted file mode 100644
index 4aa39a2..0000000
--- a/roles/flatpak/tasks/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-- name: Upgrade packages
- ansible.builtin.command: flatpak update --noninteractive
- become: true
diff --git a/roles/pacman/meta/main.yml b/roles/pacman/meta/main.yml
deleted file mode 100644
index f9d9a85..0000000
--- a/roles/pacman/meta/main.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-dependencies:
- - role: common
- - {role: etckeeper, when: etc_versioned}
- - {role: rate_mirrors, when: has_rate_mirrors}
diff --git a/roles/pacman/tasks/main.yml b/roles/pacman/tasks/main.yml
deleted file mode 100644
index ed9250d..0000000
--- a/roles/pacman/tasks/main.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-- name: Upgrade packages or fail gracefully
- become: true
- block:
- - name: Upgrade packages
- community.general.pacman:
- update_cache: true
- upgrade: true
- register: pacman_result
- notify: reboot
-
- - name: Show upgraded packages
- ansible.builtin.debug:
- var: pacman_result.packages
- when: pacman_result.changed
-
- - name: Flush handlers
- ansible.builtin.meta: flush_handlers
- rescue:
- - name: Fail if /etc is not versioned
- ansible.builtin.fail:
- msg: Upgrading packages failed for an unknown reason!
- when: not etc_versioned
-
- - name: Check for changes in /etc
- ansible.builtin.command: git status --porcelain=v1
- args:
- chdir: /etc
- register: git_status
- changed_when: false
- failed_when: false
-
- - name: Fail if there're no unstaged changes in /etc
- ansible.builtin.fail:
- msg: Upgrading packages failed for an unknown reason!
- when: not git_status.stdout
-
- - name: All changes in /etc are in pacman.d/gnupg?
- ansible.builtin.shell: |
- set -o pipefail && \
- git status --porcelain=v1 \
- | cut -c 4- \
- | grep -G -v '^pacman.d/gnupg/'
- args:
- chdir: /etc
- register: only_gnupg
- changed_when: false
- failed_when: false
-
- - name: Commit changes in /etc
- ansible.builtin.command: |
- etckeeper commit 'pacman: GPG keys'
- when: git_status.stdout and only_gnupg.rc != 0
-
- - name: Retry upgrading packages
- community.general.pacman:
- update_cache: true
- upgrade: true
- register: pacman_result
- notify: reboot
-
- - name: Show upgraded packages
- ansible.builtin.debug:
- var: pacman_result.packages
- when: pacman_result.changed
-
- - name: Flush handlers
- ansible.builtin.meta: flush_handlers
diff --git a/roles/rate_mirrors/meta/main.yml b/roles/rate_mirrors/meta/main.yml
deleted file mode 100644
index 4516fa1..0000000
--- a/roles/rate_mirrors/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-dependencies:
- - role: common
- - {role: etckeeper, when: etc_versioned}
diff --git a/roles/rate_mirrors/tasks/main.yml b/roles/rate_mirrors/tasks/main.yml
deleted file mode 100644
index 9cdab0d..0000000
--- a/roles/rate_mirrors/tasks/main.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-- name: As root user
- become: true
- block:
- - name: Fail if there're uncommitted changes in /etc
- when: etc_versioned
- block:
- - name: Check for changes in /etc
- ansible.builtin.command: git status --porcelain=v1
- args:
- chdir: /etc
- register: git_status
- changed_when: false
- failed_when: false
-
- - ansible.builtin.fail:
- msg: There are uncommitted changes in /etc
- when: git_status.stdout
-
- - name: Rate pacman mirrors
- ansible.builtin.shell: |
- . /etc/os-release && rate-mirrors \
- --allow-root \
- --disable-comments \
- --save-to-file /etc/pacman.d/mirrorlist \
- "$ID"
-
- - name: Commit pacman.d/mirrorlist
- when: etc_versioned
- block:
- - name: Check for changes in /etc
- ansible.builtin.command: git status --porcelain=v1
- args:
- chdir: /etc
- register: git_status
- changed_when: false
- failed_when: false
-
- - name: Fail if there're other uncommitted changes
- ansible.builtin.fail:
- msg: How did this happen?
- when: git_status.stdout != ' M pacman.d/mirrorlist'
-
- - name: Commit changes in /etc/pacman.d/mirrorlist
- ansible.builtin.command: |
- etckeeper commit 'rate-mirrors'
diff --git a/roles/snap/meta/main.yml b/roles/snap/meta/main.yml
deleted file mode 100644
index 4516fa1..0000000
--- a/roles/snap/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-dependencies:
- - role: common
- - {role: etckeeper, when: etc_versioned}
diff --git a/roles/snap/tasks/main.yml b/roles/snap/tasks/main.yml
deleted file mode 100644
index cce49b0..0000000
--- a/roles/snap/tasks/main.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-- name: As root user
- become: true
- block:
- - name: Check for changes in /etc
- ansible.builtin.command: git status --porcelain=v1
- args:
- chdir: /etc
- register: git_status
- changed_when: false
- failed_when: false
-
- - name: All changes in /etc are snap changes?
- ansible.builtin.shell: |
- set -o pipefail && \
- git status --porcelain=v1 \
- | cut -c 4- \
- | grep -G -v '^systemd/system/' \
- | grep -G -v '/snap\.\|snap-'
- args:
- chdir: /etc
- register: only_snap
- changed_when: false
- failed_when: false
-
- - name: Commit changes in /etc
- ansible.builtin.command: etckeeper commit 'after snap run'
- when: git_status.stdout and only_snap.rc != 0
diff --git a/roles/vagrant/tasks/main.yml b/roles/vagrant/tasks/main.yml
deleted file mode 100644
index 32e9722..0000000
--- a/roles/vagrant/tasks/main.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-- name: Update plugins
- ansible.builtin.command: vagrant plugin update
-
-- name: Prune invalid entries
- ansible.builtin.command: vagrant global-status --prune
- become: true
-
-- name: Clean up boxes
- ansible.builtin.command: vagrant box prune --force --keep-active-boxes
diff --git a/roles/yay/meta/main.yml b/roles/yay/meta/main.yml
deleted file mode 100644
index d708443..0000000
--- a/roles/yay/meta/main.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-dependencies:
- - role: common
- - {role: pacman, when: has_pacman}
diff --git a/roles/yay/tasks/main.yml b/roles/yay/tasks/main.yml
deleted file mode 100644
index 42150bf..0000000
--- a/roles/yay/tasks/main.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-- name: Upgrade packages
- kewlfft.aur.aur:
- use: yay
- update_cache: true
- upgrade: true
- aur_only: true
- register: yay_result
- notify: reboot
-
-- name: Show yay result
- ansible.builtin.debug:
- var: yay_result
- when: yay_result
-
-- name: Flush handlers
- ansible.builtin.meta: flush_handlers