refactor: update package management tasks in linux_updates.yaml and install_openitcockpit.yaml
This commit is contained in:
+33
-23
@@ -1,35 +1,45 @@
|
|||||||
---
|
---
|
||||||
- hosts: cockpithosts
|
- hosts: debianhosts
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
# Copy remote file (host.example.com:/tmp/somefile) into
|
# Copy remote file (host.example.com:/tmp/somefile) into
|
||||||
# /tmp/fetched/host.example.com/tmp/somefile on local machine
|
# /tmp/fetched/host.example.com/tmp/somefile on local machine
|
||||||
- ansible.builtin.copy:
|
|
||||||
src: ./files/openitcockpit-agent_3.1.1_amd64.deb
|
# - ansible.builtin.copy:
|
||||||
dest: /tmp/openitcockpit-agent_3.1.1_amd64.deb
|
# src: ./files/openitcockpit-agent_3.1.1_amd64.deb
|
||||||
owner: root
|
# dest: /tmp/openitcockpit-agent_3.1.1_amd64.deb
|
||||||
group: root
|
# owner: root
|
||||||
mode: '0644'
|
# group: root
|
||||||
|
# mode: '0644'
|
||||||
|
|
||||||
- name: change working directory
|
# - name: change working directory
|
||||||
ansible.builtin.shell:
|
# ansible.builtin.shell:
|
||||||
cmd: ls -l
|
# cmd: ls -l
|
||||||
chdir: /tmp
|
# chdir: /tmp
|
||||||
|
|
||||||
- name: Install openitcockpit agent
|
# - name: Install openitcockpit agent
|
||||||
ansible.builtin.shell:
|
# ansible.builtin.shell:
|
||||||
cmd: dpkg -i /tmp/openitcockpit-agent_3.1.1_amd64.deb
|
# cmd: dpkg -i /tmp/openitcockpit-agent_3.1.1_amd64.deb
|
||||||
|
|
||||||
- ansible.builtin.copy:
|
# - ansible.builtin.copy:
|
||||||
src: ./files/config.ini
|
# src: ./files/config.ini
|
||||||
dest: /etc/openitcockpit-agent/config.ini
|
# dest: /etc/openitcockpit-agent/config.ini
|
||||||
owner: root
|
# owner: root
|
||||||
group: root
|
# group: root
|
||||||
mode: '0644'
|
# mode: '0644'
|
||||||
|
|
||||||
- name: Restart openitcockpit agent
|
# - name: Restart openitcockpit agent
|
||||||
ansible.builtin.shell:
|
# ansible.builtin.shell:
|
||||||
cmd: systemctl restart openitcockpit-agent
|
# cmd: systemctl restart openitcockpit-agent
|
||||||
|
|
||||||
|
- name: Remove a package
|
||||||
|
hosts: all
|
||||||
|
become: yes # Run tasks with sudo privileges
|
||||||
|
tasks:
|
||||||
|
- name: Remove the 'opencockpit' package
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: openitcockpit-agent
|
||||||
|
state: absent
|
||||||
|
|
||||||
# - name: Install a list of packages
|
# - name: Install a list of packages
|
||||||
# ansible.builtin.apt:
|
# ansible.builtin.apt:
|
||||||
|
|||||||
+14
-23
@@ -23,31 +23,22 @@
|
|||||||
- hosts: debianhosts
|
- hosts: debianhosts
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
tasks:
|
||||||
# - name: Update all installed packages using APT module
|
- name: Update all installed packages using APT module
|
||||||
# apt:
|
apt:
|
||||||
# name: '*'
|
name: '*'
|
||||||
# state: latest
|
state: latest
|
||||||
# update_cache: yes
|
update_cache: yes
|
||||||
# only_upgrade: yes
|
only_upgrade: yes
|
||||||
# register: apt_update_status
|
register: apt_update_status
|
||||||
|
|
||||||
# - name: Remove packages not needed anymore
|
- name: Remove packages not needed anymore
|
||||||
# apt:
|
apt:
|
||||||
# autoremove: yes
|
autoremove: yes
|
||||||
|
|
||||||
# - name: Reboot when packages were updated
|
- name: Reboot when packages were updated
|
||||||
# reboot:
|
reboot:
|
||||||
# post_reboot_delay: 60
|
post_reboot_delay: 60
|
||||||
# when: apt_update_status.changed
|
when: apt_update_status.changed
|
||||||
|
|
||||||
- name: Remove a package
|
|
||||||
hosts: all
|
|
||||||
become: yes # Run tasks with sudo privileges
|
|
||||||
tasks:
|
|
||||||
- name: Remove the 'opencockpit' package
|
|
||||||
ansible.builtin.apt:
|
|
||||||
name: openitcockpit-agent
|
|
||||||
state: absent
|
|
||||||
|
|
||||||
#- hosts: apkhosts
|
#- hosts: apkhosts
|
||||||
# tasks:
|
# tasks:
|
||||||
|
|||||||
Reference in New Issue
Block a user