Unverified Commit d29fdaab authored by Nicholas Rhodes's avatar Nicholas Rhodes Committed by GitHub

Merge pull request #73 from popindavibe/configsnap_dockerfile_fix

configsnap, epel and Dockerfile updates
parents 9bbbd058 43a8842b
Pipeline #44 failed with stages
......@@ -45,7 +45,6 @@ Things to consider when filling the csv file:
| APPLYMONTH | Month(s) to execute `auter-apply` | None |
| ALWAYSREBOOT | Should the device systematically be rebooted after patching? ==This option superseeds **AUTOREBOOT**.== | `no` |
## Playbooks
- `auter_manager.yml` loads up `auter_installer` and `auter_scheduler` roles to install, configure and schedule Auter based on devices configured in the CSV file. It is intended to be the 'default' playbook to use to set up everything in one go.
- `auter_install.yml` will install and configure Auter based on devices configured in the CSV file.
......
DEST='/root'
# look for the latest configsnap pre, no further than an hour ago
PRE=$(find ${DEST} -type d -name "auter-configsnap-*" -mmin -60 | tail -n1)
if [[ -z "${PRE}" || ! -d ${PRE} ]]; then
logger -p warn -t auter "configsnap prep ${DEST}/${PRE} not found. There will be no comparison."
PRE=auter-configsnap-$(date +%Y-%m-%d)
/usr/sbin/configsnap -d ${DEST} -t ${PRE} -p post-update
else
PRE=$(basename "${PRE}")
/usr/sbin/configsnap -d ${DEST} -t ${PRE} -p post-update &> ${DEST}/${PRE}/configsnap/post-update.compare
fi
if find /root/auter-configsnap-$(date +%Y-%m-%d)/configsnap/ -name "*.pre" &>/dev/null; then
exit 0
else
logger -p info -t auter "INFO: Configsnap pre-apply files missing, running $0 for post-reboot diff."
/usr/sbin/configsnap --silent -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p pre
exit 0
fi
DEST='/root'
# look for the latest configsnap pre, no further than an hour ago
PRE=$(find ${DEST} -type d -name "auter-configsnap-*" -mmin -60 | tail -n1)
if [[ -z "${PRE}" || ! -d ${PRE} ]]; then
logger -p warn -t auter "configsnap prep ${DEST}/${PRE} not found. There will be no comparison."
PRE=auter-configsnap-$(date +%Y-%m-%d)
/usr/sbin/configsnap -d ${DEST} -t ${PRE} -p post-reboot
else
PRE=$(basename "${PRE}")
/usr/sbin/configsnap -d ${DEST} -t ${PRE} -p post-reboot &> ${DEST}/${PRE}/configsnap/post-reboot.compare
fi
......@@ -6,53 +6,27 @@
state: latest
- name: create configsnap pre apply script
lineinfile:
create: yes
state: present
copy:
content: "/usr/sbin/configsnap --silent -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p pre"
dest: /etc/auter/pre-apply.d/01-configsnap-pre
mode: 0755
regexp: configsnap.*pre
line: /usr/sbin/configsnap --silent -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p pre
- name: create configsnap post apply script
lineinfile:
create: yes
state: present
copy:
src: 50-configsnap-post-apply
dest: /etc/auter/post-apply.d/50-configsnap-post-apply
mode: 0755
regexp: configsnap.*post-update
line: /usr/sbin/configsnap -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p post-update &> /root/auter-configsnap-$(date +%Y-%m-%d)/configsnap/post-update.compare
- name: delete old configsnap pre reboot script if it exists
file:
state: absent
dest: /etc/auter/pre-reboot.d/99-configsnap-pre-reboot
- name: create configsnap pre reboot script
blockinfile:
backup: no
create: yes
state: present
mode: 0755
marker: "# {mark} ANSIBLE MANAGED AUTER BLOCK"
copy:
src: 98-configsnap-pre-reboot
dest: /etc/auter/pre-reboot.d/98-configsnap-pre-reboot
block: |2
if find /root/auter-configsnap-$(date +%Y-%m-%d)/configsnap/ -name "*.pre" &>/dev/null; then
exit 0
else
logger -p info -t auter "INFO: Configsnap pre-apply files missing, running $0 for post-reboot diff."
/usr/sbin/configsnap --silent -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p pre
exit 0
fi
no_log: true
mode: 0755
- name: create configsnap post reboot script
lineinfile:
create: yes
state: present
copy:
src: 99-configsnap-post-reboot
dest: /etc/auter/post-reboot.d/99-configsnap-post-reboot
mode: 0755
regexp: configsnap.*post-reboot
line: '/usr/sbin/configsnap -d /root -t auter-configsnap-$(date +%Y-%m-%d) -p post-reboot &> /root/auter-configsnap-$(date +%Y-%m-%d)/configsnap/post-reboot.compare'
...
......@@ -36,6 +36,7 @@
state: latest
when: >
epelPresent.stdout|int == 0 and
"no package" in result.msg|lower
("no package" in result.msg|lower or
"no package" in result.failures|lower)
...
# Prepping for auter deploy
FROM centos
## Latest is CentOS 8, coming with dnf and no python/python3 binary and no ansible package in repo
## CentOS 8, no Auter there yet
#FROM centos
#RUN echo "Updating OS"
#RUN dnf update -y
#RUN echo "Installing required packages"
#RUN dnf install -y python3 python3-pip
#RUN pip3 install ansible
# CentOS 7
FROM centos:centos7
RUN echo "Updating OS"
RUN yum update -y
RUN echo "Installing required packages"
RUN yum install -y ansible
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment