Skip to content

Commit

Permalink
https://github.com/ansible/ansible-lint/pull/2527
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Oct 2, 2022
1 parent 36a441e commit f272f6d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 29 deletions.
27 changes: 15 additions & 12 deletions playbooks/side_effect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,33 @@
- { dest: "/etc/ansible/group_vars/all/99-packer.yml" }

- name: debian | apt-get dist-upgrade
ansible.builtin.raw: |
set -eu
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
ansible.builtin.raw:
cmd: |
set -eu
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y
args:
executable: "/bin/bash"
changed_when: false
failed_when: false

- name: redhat | yum update
ansible.builtin.raw: |
set -eu
yum makecache
yum update -y
ansible.builtin.raw:
cmd: |
set -eu
yum makecache
yum update -y
args:
executable: "/bin/bash"
changed_when: false
failed_when: false

- name: suse | zypper dist-upgrade
ansible.builtin.raw: |
set -eu
zypper -n --gpg-auto-import-keys refresh
zypper -n dist-upgrade -y --allow-vendor-change
ansible.builtin.raw:
cmd: |
set -eu
zypper -n --gpg-auto-import-keys refresh
zypper -n dist-upgrade -y --allow-vendor-change
args:
executable: "/bin/bash"
changed_when: false
Expand Down
36 changes: 19 additions & 17 deletions playbooks/tasks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
until: result is succeeded

- name: download archive
ansible.builtin.shell: |
set -euxo pipefail
mkdir -p /var/log/ansible
exec &> >(tee -a /var/log/ansible/{{ item.checksum }}-get_url.log)
TMP_DIR="$(mktemp -d)" \
&& cd $TMP_DIR \
&& mkdir -p .{{ item.dest | dirname }} \
&& curl -skL -m 300 {{ item.url }} > .{{ item.dest }} \
&& echo -n "{{ item.checksum }} .{{ item.dest }}" | sha256sum -c - \
&& mkdir -p {{ item.dest | dirname }} \
&& mv .{{ item.dest }} {{ item.dest }} \
&& rm -rf $TMP_DIR
ansible.builtin.shell:
cmd: |
set -euxo pipefail
mkdir -p /var/log/ansible
exec &> >(tee -a /var/log/ansible/{{ item.checksum }}-get_url.log)
TMP_DIR="$(mktemp -d)" \
&& cd $TMP_DIR \
&& mkdir -p .{{ item.dest | dirname }} \
&& curl -skL -m 300 {{ item.url }} > .{{ item.dest }} \
&& echo -n "{{ item.checksum }} .{{ item.dest }}" | sha256sum -c - \
&& mkdir -p {{ item.dest | dirname }} \
&& mv .{{ item.dest }} {{ item.dest }} \
&& rm -rf $TMP_DIR
args:
executable: "/bin/bash"
creates: "/var/log/ansible/{{ item.checksum }}-get_url.log"
Expand All @@ -44,11 +45,12 @@
until: result is succeeded

- name: yum install
ansible.builtin.shell: |
set -euxo pipefail
mkdir -p /var/log/ansible
exec &> >(tee -a /var/log/ansible/{{ item.checksum }}-unarchive.log)
yum install -y {{ item.dest }}
ansible.builtin.shell:
cmd: |
set -euxo pipefail
mkdir -p /var/log/ansible
exec &> >(tee -a /var/log/ansible/{{ item.checksum }}-unarchive.log)
yum install -y {{ item.dest }}
args:
executable: "/bin/bash"
creates: "/var/log/ansible/{{ item.checksum }}-unarchive.log"
Expand Down

0 comments on commit f272f6d

Please sign in to comment.