9 Commits

Author SHA1 Message Date
08a725ed68 Use yum command direct 2020-11-27 00:07:33 +13:00
438962933f Linting fixes 2020-11-26 23:12:45 +13:00
61a0209ece Revert back to temp download 2020-11-26 15:37:47 +13:00
7530f82e62 Added second package check 2020-11-26 15:19:50 +13:00
a71bcb9638 Added block/rescue to catch failed install 2020-11-26 14:16:53 +13:00
04a23c4976 Make firewall open immediately 2020-11-26 13:18:48 +13:00
445642b193 Merge changes to origin 2020-11-26 12:19:42 +13:00
a67d4af041 Updated to present from installed 2020-11-25 21:54:04 +13:00
396fdf006b revert to package module 2020-11-25 21:48:55 +13:00
6 changed files with 54 additions and 19 deletions

View File

@@ -1,3 +1,5 @@
# .ansible-lint │ # .ansible-lint │
warn_list: # or 'skip_list' to silence them completely warn_list: [] # or 'skip_list' to silence them completely
- '106' # Role name {} does not match ``^[a-z][a-z0-9_]+$`` pattern skip_list:
- '403'
- '106'

View File

@@ -15,7 +15,9 @@
port: 6556/tcp port: 6556/tcp
state: enabled state: enabled
permanent: yes permanent: yes
immediate: yes
- name: ensure firewall reloaded - name: remove agent
command: firewall-cmd --reload file:
changed_when: false path: /tmp/check-mk-agent.rpm
state: absent

0
lint Normal file
View File

View File

@@ -6,7 +6,7 @@ driver:
platforms: platforms:
- name: rhel8 - name: rhel8
image: guisea/centos8-ansible:latest image: guisea/centos8-ansible:latest
#dockerfile: Centos8-Dockerfile # dockerfile: Centos8-Dockerfile
privileged: True privileged: True
volume_mounts: volume_mounts:
- "/sys/fs/cgroup:/sys/fs/cgroup:rw" - "/sys/fs/cgroup:/sys/fs/cgroup:rw"
@@ -28,4 +28,4 @@ lint: |
set -e set -e
yamllint . yamllint .
ansible-lint ansible-lint
flake8 flake8

View File

@@ -1,5 +1,32 @@
- name: Register with CheckMK Update Server - block:
shell: | - name: Register with CheckMK Update Server
cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \ shell: |
--secret {{ cmk_secret }} cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \
changed_when: false --secret {{ cmk_secret }}
changed_when: false
notify: remove agent
rescue:
- name: Gather facts of packages
package_facts:
manager: "auto"
- name: Ensure check_mk_agent installed (again)
command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm
args:
warn: no
notify:
- restart xinetd
- ensure firewall open
when: "'check-mk-agent' not in ansible_facts.packages"
- name: Gather facts of packages (again)
package_facts:
manager: "auto"
- name: Register with CheckMK Update Server (retry)
shell: |
cmk-update-agent register -H $(hostname -s) --user {{ cmk_username }} \
--secret {{ cmk_secret }}
changed_when: false
when: "'check-mk-agent' in ansible_facts.packages"
notify: remove agent

View File

@@ -1,9 +1,9 @@
--- ---
# Tasks for installation on RedHat Family # Tasks for installation on RedHat Family
- name: Ensure xinetd installed - name: Ensure xinetd installed
yum: package:
name: xinetd name: xinetd
state: installed state: present
notify: restart xinetd notify: restart xinetd
- name: Gather facts of packages - name: Gather facts of packages
@@ -11,12 +11,16 @@
manager: "auto" manager: "auto"
- name: Install check-mk-agent - name: Install check-mk-agent
block: block:
- name: Download the agent from Server
get_url:
url: "{{ cmk_rpm_agent }}{{ cmk_auth }}"
dest: /tmp/check-mk-agent.rpm
- name: Ensure check_mk_agent installed - name: Ensure check_mk_agent installed
package: command: /usr/bin/yum install --nogpgcheck -y /tmp/check-mk-agent.rpm
name: "{{ cmk_rpm_agent }}{{ cmk_auth }}" args:
state: latest warn: no
disable_gpg_check: true
notify: notify:
- restart xinetd - restart xinetd
- cmk fresh install - cmk fresh install