Update ansible code
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Adrien Reslinger 2022-11-30 07:19:40 +01:00
parent 2ca2ad9796
commit eec95be2de
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
8 changed files with 175 additions and 175 deletions

View file

@ -1,10 +1,10 @@
---
#- name: Add docker apt key
# ansible.builtin.get_url:
# url: https://download.docker.com/linux/ubuntu/gpg.asc
# dest: /etc/apt/keyrings/docker.gpg
# when:
# - docker_ver == "docker_ce"
# - name: Add docker apt key
# ansible.builtin.get_url:
# url: https://download.docker.com/linux/ubuntu/gpg.asc
# dest: /etc/apt/keyrings/docker.gpg
# when:
# - docker_ver == "docker_ce"
- name: Add docker apt key
ansible.builtin.copy:
src: etc/apt/keyrings/docker.gpg
@ -13,16 +13,16 @@
- docker_ver == "docker_ce"
- name: Add docker repository
apt_repository:
ansible.builtin.apt_repository:
repo: 'deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable'
filename: docker-ce
state: present
update_cache: yes
update_cache: true
when:
- docker_ver == "docker_ce"
- name: "Ensure GRUB_CMDLINE_LINUX is updated"
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/default/grub
regexp: '^(GRUB_CMDLINE_LINUX=".*)"$'
line: '\1 cgroup_enable=memory swapaccount=1"'
@ -31,33 +31,33 @@
- not docker_installed.stat.exists
- name: "Update grub.conf"
command: update-grub
ansible.builtin.command: update-grub
when:
- not docker_installed.stat.exists
- name: Check whether ufw status is active
shell: ufw status
ansible.builtin.shell: ufw status
changed_when: False
ignore_errors: True
register: ufw_check
check_mode: false
- name: "Ensure DEFAULT_FORWARD_POLICY in /etc/default/ufw is updated"
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/default/ufw
regexp: '^(DEFAULT_FORWARD_POLICY=").*"$'
line: '\1ACCEPT"'
backrefs: yes
notify: reload ufw
when: "'inactive' not in ufw_check.stdout"
tags: [docker,firewall]
tags: [docker, firewall]
# Need Certificat ? Only in local
#- name: "Add docker port 2376/TCP "
# ufw: rule=allow port=2376 proto=tcp
# notify: reload ufw
# tags: [docker,firewall]
# - name: "Add docker port 2376/TCP "
# ufw: rule=allow port=2376 proto=tcp
# notify: reload ufw
# tags: [docker,firewall]
#- name: "Start UFW rules"
# service: name=ufw state=started
# tags: [docker,firewall]
# - name: "Start UFW rules"
# service: name=ufw state=started
# tags: [docker,firewall]