diff --git a/baremetal/files/apcupsd/config.py b/apcupsd/files/apcupsd/config.py similarity index 100% rename from baremetal/files/apcupsd/config.py rename to apcupsd/files/apcupsd/config.py diff --git a/baremetal/files/apcupsd/ganeti-ups.py b/apcupsd/files/apcupsd/ganeti-ups.py similarity index 100% rename from baremetal/files/apcupsd/ganeti-ups.py rename to apcupsd/files/apcupsd/ganeti-ups.py diff --git a/baremetal/files/apcupsd/ganeti.py b/apcupsd/files/apcupsd/ganeti.py similarity index 100% rename from baremetal/files/apcupsd/ganeti.py rename to apcupsd/files/apcupsd/ganeti.py diff --git a/baremetal/files/apcupsd/gnt-ha-client.py b/apcupsd/files/apcupsd/gnt-ha-client.py similarity index 100% rename from baremetal/files/apcupsd/gnt-ha-client.py rename to apcupsd/files/apcupsd/gnt-ha-client.py diff --git a/baremetal/files/apcupsd/gnt-ha-daemon.py b/apcupsd/files/apcupsd/gnt-ha-daemon.py similarity index 100% rename from baremetal/files/apcupsd/gnt-ha-daemon.py rename to apcupsd/files/apcupsd/gnt-ha-daemon.py diff --git a/baremetal/files/apcupsd/killpower/portal b/apcupsd/files/apcupsd/killpower/portal similarity index 100% rename from baremetal/files/apcupsd/killpower/portal rename to apcupsd/files/apcupsd/killpower/portal diff --git a/baremetal/files/apcupsd/killpower/rumo b/apcupsd/files/apcupsd/killpower/rumo similarity index 100% rename from baremetal/files/apcupsd/killpower/rumo rename to apcupsd/files/apcupsd/killpower/rumo diff --git a/baremetal/files/apcupsd/killpower/video-main b/apcupsd/files/apcupsd/killpower/video-main similarity index 100% rename from baremetal/files/apcupsd/killpower/video-main rename to apcupsd/files/apcupsd/killpower/video-main diff --git a/baremetal/files/apcupsd/onbattery/vm01 b/apcupsd/files/apcupsd/onbattery/vm01 similarity index 100% rename from baremetal/files/apcupsd/onbattery/vm01 rename to apcupsd/files/apcupsd/onbattery/vm01 diff --git a/baremetal/files/apcupsd/onbattery/vm02 b/apcupsd/files/apcupsd/onbattery/vm02 similarity index 100% rename from baremetal/files/apcupsd/onbattery/vm02 rename to apcupsd/files/apcupsd/onbattery/vm02 diff --git a/baremetal/files/apcupsd/vm-onbattery.py b/apcupsd/files/apcupsd/vm-onbattery.py similarity index 100% rename from baremetal/files/apcupsd/vm-onbattery.py rename to apcupsd/files/apcupsd/vm-onbattery.py diff --git a/apcupsd/handlers/main.yml b/apcupsd/handlers/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..1b6bc7612459320a55179b6d4c23b743afce2d9d --- /dev/null +++ b/apcupsd/handlers/main.yml @@ -0,0 +1,5 @@ +--- + +- name: restart apcupsd + service: name=apcupsd state=restarted + diff --git a/baremetal/tasks/apcupsd.yml b/apcupsd/tasks/main.yml similarity index 100% rename from baremetal/tasks/apcupsd.yml rename to apcupsd/tasks/main.yml diff --git a/baremetal/templates/apcupsd.conf.j2 b/apcupsd/templates/apcupsd.conf.j2 similarity index 100% rename from baremetal/templates/apcupsd.conf.j2 rename to apcupsd/templates/apcupsd.conf.j2 diff --git a/baremetal/handlers/main.yml b/baremetal/handlers/main.yml index ca1e9689930e59513c2c3b41211d58f910938f03..bba3ef7b923d83788e4a66b721dd7d263e8ebacf 100644 --- a/baremetal/handlers/main.yml +++ b/baremetal/handlers/main.yml @@ -1,9 +1,8 @@ --- -# file: roles/baremetal/handlers/main.yml +# file: baremetal/handlers/main.yml - name: restart lldpd - service: name=lldpd state=restarted - -- name: restart apcupsd - service: name=apcupsd state=restarted + service: + name: lldpd + state: restarted diff --git a/baremetal/meta/main.yml b/baremetal/meta/main.yml deleted file mode 100644 index b700983a1e3af5e4f0b3727ab258e3e877b572cc..0000000000000000000000000000000000000000 --- a/baremetal/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - { role: "zabbix-agent", when: "'zabbix-agent' in group_names"} - diff --git a/baremetal/tasks/bond.yml b/baremetal/tasks/bond.yml deleted file mode 100644 index e64addd1619f23561e4687c60d614e0c3b6348d3..0000000000000000000000000000000000000000 --- a/baremetal/tasks/bond.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# file: roles/baremetal/tasks/bond.yml - -- name: ensure ifenslave is installed - apt: state=latest name=ifenslave - tags: - - bond - - packages - -#- name: ensure bonding is configured -# template: src=interfaces.j2 dest=/etc/network/interfaces owner=root group=root mode=0644 -# when: "not 'vm' in ansible_hostname" -# tags: -# - bond -# - config - diff --git a/baremetal/tasks/lldpd.yml b/baremetal/tasks/lldpd.yml deleted file mode 100644 index 8fc3c6f64fb68fe92d647bf64a925d94a763716f..0000000000000000000000000000000000000000 --- a/baremetal/tasks/lldpd.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- -# file: roles/baremetal/tasks/lldpd.yml - -- name: ensure lldpd is installed - apt: state=latest name=lldpd - notify: - - restart lldpd - tags: - - lldpd - - packages - -- name: ensure lldpd is configured - copy: src=lldpd dest=/etc/default/lldpd owner=root group=root mode=0644 - notify: - - restart lldpd - tags: - - lldpd - - config - -- name: ensure lldpd is enabled and running - service: name=lldpd state=running enabled=yes - tags: - - lldpd - - service - diff --git a/baremetal/tasks/main.yml b/baremetal/tasks/main.yml index a9c2c50d6e541be29f298c4e478120c2958c22d5..59714ef32600bd12c8756583f8454df2b20a522f 100644 --- a/baremetal/tasks/main.yml +++ b/baremetal/tasks/main.yml @@ -1,36 +1,54 @@ --- -# file: roles/baremetal/tasks/main.yml +# file: baremetal/tasks/main.yml -- include: apcupsd.yml -- meta: flush_handlers -- include: bond.yml -- meta: flush_handlers -- include: lldpd.yml -- meta: flush_handlers -- name: ensure packages for nagios on baremetal are installed - apt: name={{ item }} state=present +- name: ensure baremetal-specific packages are installed + apt: + name: {{ item }} + state: installed with_items: - - lm-sensors - - hddtemp + - lldpd + - lm-sensors + - hddtemp + - smartmontools + - hdparm tags: - - packages - - nagios -- name: ensure hardware-tools are installed - apt: name={{ item }} state=present - with_items: - - smartmontools - - hdparm + - baremetal + - packages + +- name: ensure lldpd is configured + copy: + src: lldpd + dest: /etc/default/lldpd + owner: root + group: root + mode: 0644 + notify: + - restart lldpd tags: - - packages - - hardware-tools + - baremetal -- name: ensure zabbix-smart-check is installed - apt: name={{ item }} state=present - with_items: - - zabbix-check-smart - - zabbix-check-disk-performance - when: "'zabbix-agent' in group_names" - tags: - - packages - - hardware-tools - - chr +- name: ensure lldpd is enabled and running + service: + name: lldpd + state: running + enabled: yes + tags: + - baremetal + +- name: ensure microcode updates are available (Intel) + apt: + name: intel-microcode + state: installed + when: ansible_processor[1] == 'GenuineIntel' + tags: + - baremetal + - packages + +- name: ensure microcode updates are available (AMD) + apt: + name: amd64-microcode + state: installed + when: ansible_processor[1] == 'AuthenticAMD' + tags: + - baremetal + - packages diff --git a/baremetal/templates/interfaces.j2 b/baremetal/templates/interfaces.j2 deleted file mode 100644 index 595a46ff104272260ca334cfc69a008cfc2ad11e..0000000000000000000000000000000000000000 --- a/baremetal/templates/interfaces.j2 +++ /dev/null @@ -1,27 +0,0 @@ -# This file describes the network interfaces available on your system -# and how to activate them. For more information, see interfaces(5). - -source /etc/network/interfaces.d/* - -# The loopback network interface -auto lo -iface lo inet loopback -{% if bond %} -# The bond0 -auto lo bond0 -iface bond0 inet static - address {{ ipaddr }} - netmask {{ netmask }} - gateway {{ gateway }} - slaves eth0 eth1 - bond_mode 802.3ad - bond_xmit_hash_policy layer2+3 - -{% else %} -auto {{ interface }} -iface {{ interface }} inet static - address {{ ipaddr }} - netmask {{ netmask }} - gateway {{ gateway }} -{% endif %} -