diff options
Diffstat (limited to 'roles')
-rw-r--r-- | roles/apt/meta/main.yml | 2 | ||||
-rw-r--r-- | roles/apt/tasks/main.yml | 37 | ||||
-rw-r--r-- | roles/common/tasks/main.yml | 16 | ||||
-rw-r--r-- | roles/common/tasks/tool.yml | 8 | ||||
-rw-r--r-- | roles/docker/tasks/main.yml | 7 | ||||
-rw-r--r-- | roles/etckeeper/tasks/main.yml | 31 | ||||
-rw-r--r-- | roles/flatpak/tasks/main.yml | 9 | ||||
-rw-r--r-- | roles/pacman/meta/main.yml | 4 | ||||
-rw-r--r-- | roles/pacman/tasks/main.yml | 9 | ||||
-rw-r--r-- | roles/rate_mirrors/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/rate_mirrors/tasks/main.yml | 9 | ||||
-rw-r--r-- | roles/snap/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/vagrant/tasks/main.yml | 22 | ||||
-rw-r--r-- | roles/yay/meta/main.yml | 3 | ||||
-rw-r--r-- | roles/yay/tasks/main.yml | 34 |
15 files changed, 83 insertions, 114 deletions
diff --git a/roles/apt/meta/main.yml b/roles/apt/meta/main.yml index 3d3d0a1..4516fa1 100644 --- a/roles/apt/meta/main.yml +++ b/roles/apt/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - role: common - - role: etckeeper + - {role: etckeeper, when: etc_versioned} diff --git a/roles/apt/tasks/main.yml b/roles/apt/tasks/main.yml index f331995..d658651 100644 --- a/roles/apt/tasks/main.yml +++ b/roles/apt/tasks/main.yml @@ -1,26 +1,19 @@ -- name: Check if apt is installed - command: apt-get --version - register: apt_version - changed_when: false - failed_when: false - -- when: apt_version.rc == 0 +- name: Upgrade packages become: true - block: - - name: Upgrade packages - apt: - update_cache: true - upgrade: full - notify: reboot + apt: + update_cache: true + upgrade: full + notify: reboot - - name: Flush handlers - meta: flush_handlers +- name: Flush handlers + meta: flush_handlers - - name: Clean up dependencies - apt: - autoremove: true - purge: true - notify: reboot +- name: Clean up dependencies + become: true + apt: + autoremove: true + purge: true + notify: reboot - - name: Flush handlers - meta: flush_handlers +- name: Flush handlers + meta: flush_handlers diff --git a/roles/common/tasks/main.yml b/roles/common/tasks/main.yml new file mode 100644 index 0000000..558f268 --- /dev/null +++ b/roles/common/tasks/main.yml @@ -0,0 +1,16 @@ +- include_tasks: tool.yml + loop: + - apt + - docker + - flatpak + - pacman + - rate-mirrors + - snap + - vagrant + - yay + +- name: Check if /etc is versioned + become: true + stat: + path: /etc/.git/config + register: etc_versioned diff --git a/roles/common/tasks/tool.yml b/roles/common/tasks/tool.yml new file mode 100644 index 0000000..f8fda64 --- /dev/null +++ b/roles/common/tasks/tool.yml @@ -0,0 +1,8 @@ +- name: "Check for {{ item }}" + command: "{{ item }} --version" + register: cmd_result + changed_when: false + failed_when: false + +- name: "Set fact about {{ item }}" + set_fact: "has_{{ item | replace('-', '_') }}={{ cmd_result.rc == 0 }}" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index eddc811..e39d66f 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -1,9 +1,3 @@ -- name: Check if Docker is installed - command: docker --version - register: docker_version - changed_when: false - failed_when: false - - name: Clean up Docker data become: true command: docker system prune -a -f --volumes @@ -16,4 +10,3 @@ # networks: true # volumes: true # builder_cache: true - when: docker_version.rc == 0 diff --git a/roles/etckeeper/tasks/main.yml b/roles/etckeeper/tasks/main.yml index 3e37ed1..0339c61 100644 --- a/roles/etckeeper/tasks/main.yml +++ b/roles/etckeeper/tasks/main.yml @@ -1,22 +1,15 @@ - become: true block: - - name: Check if /etc is versioned - stat: - path: /etc/.git/config - register: etc_versioned + - name: Set user.name + community.general.git_config: + scope: local + repo: /etc + name: user.name + value: '{{ git_name }}' - - when: etc_versioned - 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 }}' + - 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 index 3fb28c3..fc3f7ba 100644 --- a/roles/flatpak/tasks/main.yml +++ b/roles/flatpak/tasks/main.yml @@ -1,10 +1,3 @@ -- name: Check if flatpak is installed - command: flatpak --version - register: flatpak_version - changed_when: false - failed_when: false - -- when: flatpak_version.rc == 0 - name: Upgrade packages +- name: Upgrade packages command: flatpak update --noninteractive become: true diff --git a/roles/pacman/meta/main.yml b/roles/pacman/meta/main.yml index 3a79dd0..f9d9a85 100644 --- a/roles/pacman/meta/main.yml +++ b/roles/pacman/meta/main.yml @@ -1,4 +1,4 @@ dependencies: - role: common - - role: etckeeper - - role: rate_mirrors + - {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 index acd2d31..1669920 100644 --- a/roles/pacman/tasks/main.yml +++ b/roles/pacman/tasks/main.yml @@ -1,11 +1,4 @@ -- name: Check if pacman is installed - command: pacman --version - register: pacman_version - changed_when: false - failed_when: false - -- when: pacman_version.rc == 0 - become: true +- become: true block: - name: Upgrade packages community.general.pacman: diff --git a/roles/rate_mirrors/meta/main.yml b/roles/rate_mirrors/meta/main.yml index cc61eb8..4516fa1 100644 --- a/roles/rate_mirrors/meta/main.yml +++ b/roles/rate_mirrors/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - - role: etckeeper + - role: common + - {role: etckeeper, when: etc_versioned} diff --git a/roles/rate_mirrors/tasks/main.yml b/roles/rate_mirrors/tasks/main.yml index 3334483..7aff26e 100644 --- a/roles/rate_mirrors/tasks/main.yml +++ b/roles/rate_mirrors/tasks/main.yml @@ -1,11 +1,4 @@ -- name: Check if rate-mirrors is installed - command: rate-mirrors --version - register: rate_mirrors_version - changed_when: false - failed_when: false - -- when: rate_mirrors_version.rc == 0 - become: true +- become: true block: - when: etc_versioned block: diff --git a/roles/snap/meta/main.yml b/roles/snap/meta/main.yml index cc61eb8..4516fa1 100644 --- a/roles/snap/meta/main.yml +++ b/roles/snap/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - - role: etckeeper + - role: common + - {role: etckeeper, when: etc_versioned} diff --git a/roles/vagrant/tasks/main.yml b/roles/vagrant/tasks/main.yml index 31bfe11..53a64c2 100644 --- a/roles/vagrant/tasks/main.yml +++ b/roles/vagrant/tasks/main.yml @@ -1,17 +1,9 @@ -- name: Check if vagrant is installed - command: vagrant --version - register: vagrant_version - changed_when: false - failed_when: false +- name: Update plugins + command: vagrant plugin update -- when: vagrant_version.rc == 0 - block: - - name: Update plugins - command: vagrant plugin update +- name: Prune invalid entries + command: vagrant global-status --prune + become: true - - name: Prune invalid entries - command: vagrant global-status --prune - become: true - - - name: Clean up boxes - command: vagrant box prune --force --keep-active-boxes +- name: Clean up boxes + command: vagrant box prune --force --keep-active-boxes diff --git a/roles/yay/meta/main.yml b/roles/yay/meta/main.yml index 99c8bbf..d708443 100644 --- a/roles/yay/meta/main.yml +++ b/roles/yay/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - - role: pacman + - role: common + - {role: pacman, when: has_pacman} diff --git a/roles/yay/tasks/main.yml b/roles/yay/tasks/main.yml index a8a1c70..bd8effb 100644 --- a/roles/yay/tasks/main.yml +++ b/roles/yay/tasks/main.yml @@ -1,23 +1,15 @@ -- name: Check if yay is installed - command: yay --version - register: yay_version - changed_when: false - failed_when: false +- name: Upgrade packages + kewlfft.aur.aur: + use: yay + update_cache: true + upgrade: true + aur_only: true + register: yay_result + notify: reboot -- when: yay_version.rc == 0 - block: - - name: Upgrade packages - kewlfft.aur.aur: - use: yay - update_cache: true - upgrade: true - aur_only: true - register: yay_result - notify: reboot +- debug: + var: yay_result + when: yay_result - - debug: - var: yay_result - when: yay_result - - - name: Flush handlers - meta: flush_handlers +- name: Flush handlers + meta: flush_handlers |