From 92ef17cdc14f50014a9c5e9f5ee157dcf64441c4 Mon Sep 17 00:00:00 2001 From: Sebastien Laithier Date: Wed, 17 Aug 2022 16:33:32 +0200 Subject: [PATCH] Adding tst inventory, ansible.cfg --- ansible/2022-08-17.csv | 19 ++++++++ ansible/ansible.cfg | 12 +++++ .../update_dashboard.cpython-38.pyc | Bin 0 -> 1267 bytes ansible/hooks/update_dashboard.py | 23 +++++++++ ansible/hosts-tst | 44 ++++++++++++++++++ .../{ => playbooks}/auto-updates-result.yml | 0 ansible/{ => playbooks}/main.yml | 23 +-------- ansible/{ => playbooks}/packages.yml | 13 ++---- ansible/{ => playbooks}/packages_include.yml | 0 9 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 ansible/2022-08-17.csv create mode 100644 ansible/ansible.cfg create mode 100644 ansible/hooks/__pycache__/update_dashboard.cpython-38.pyc create mode 100644 ansible/hooks/update_dashboard.py create mode 100644 ansible/hosts-tst rename ansible/{ => playbooks}/auto-updates-result.yml (100%) rename ansible/{ => playbooks}/main.yml (65%) rename ansible/{ => playbooks}/packages.yml (89%) rename ansible/{ => playbooks}/packages_include.yml (100%) diff --git a/ansible/2022-08-17.csv b/ansible/2022-08-17.csv new file mode 100644 index 0000000..ed86e8a --- /dev/null +++ b/ansible/2022-08-17.csv @@ -0,0 +1,19 @@ +vlearning-db001-tst.infolegale.net;Debian;10;0;5 +app-db001-tst.infolegale.net;Debian;10;0;9 +consults-db001-tst.infolegale.net;Debian;10;0;147 +vador-db001-tst.infolegale.net;Debian;10;0;147 +tlearning-db003-tst.infolegale.net;Ubuntu;18.04;0;308 +transdb-db001-tst.infolegale.net;Debian;10;0;147 +mysql8-db001-tst.infolegale.net;Debian;11;3;119 +mongo-db001-tst.infolegale.net;Ubuntu;20.04;0;28 +orchestrator-mgr001-tst.infolegale.net;Ubuntu;20.04;0;28 +redis5-db001-tst.infolegale.net;Debian;10;0;326 +redis-db001-tst.infolegale.net;Ubuntu;18.04;0;326 +docker-hpv001-tst.infolegale.net;Ubuntu;20.04;0;106 +docker-hpv002-tst.infolegale.net;Ubuntu;20.04;0;398 +docker-hpv004-tst.infolegale.net;Ubuntu;20.04;0;28 +rundeck-sch001-tst.infolegale.net;Debian;10;0;91 +docker-hpv003-tst.infolegale.net;Ubuntu;20.04;0;125 +proxysql-db001-tst.infolegale.net;Ubuntu;20.04;0;475 +docker-hpv005-tst.infolegale.net;Ubuntu;20.04;0;119 +docker-hpv006-tst.infolegale.net;Ubuntu;20.04;0;309 diff --git a/ansible/ansible.cfg b/ansible/ansible.cfg new file mode 100644 index 0000000..64fe4aa --- /dev/null +++ b/ansible/ansible.cfg @@ -0,0 +1,12 @@ +[defaults] +vault_password_file = ~/.vault_password +roles_path = roles +interpreter_python = auto +callback_plugins = ./hooks/ +fact_caching = jsonfile +fact_caching_connection = ~/.cache/ansible/ +deprecation_warnings=False +[hashi_vault_collection] +url = "https://vault.infolegale.net" +token_file = .vault-token +token_validate = None diff --git a/ansible/hooks/__pycache__/update_dashboard.cpython-38.pyc b/ansible/hooks/__pycache__/update_dashboard.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dac381c6d5887cecaa2fe335796108dd17a6fd29 GIT binary patch literal 1267 zcmaJ>&2AGh5VpNP*|teqXjRIE0}`Mhkw`rufl$+sLPZ)-3rOt6a@J0=&He;?x2RP) zwGYyYQ(uAy@s$&=fH*Kt+BB(9NAkBGd&d6e^JqVnO7jTp+mFAUp9G;_#+f!7oDCT2 zIRHl-M<~WVj)_lV%eOERw(r0?iQKs07chE*xW(;L#BEVHv3!p^d#K|6hHO-^^djr1 zG|DqU!+4m=OnW>$2vwLSx;&I&lF@FS1R3}htcwj6MI9ClHklHEIbqr?a5iA5bpU~U z%#lwx_AO3)n_Ixj=FTbdUGDM%d<(qD=lJ|722KmWsiezS=kKIEk3Qx-=(2S{pcG;+SU7%8^Jj%4y6Pb2K(tv!n5>Z#X<2`?YB`WMh zg2E9ONZtVof9kb<8jG3|omwx=Q<*1;kTgwb zIw+a?JOG4?xQuOl^k7!F>WzdMm5gE&l~%#Ypou^od`8aEDw-%l+DGL_>cyw_ZnNHa zTi~W!P1t*TY9o zZlgbyvlW;pzOtF;zP*q+C}gX?-D*h^9=sE{(1>L&l?8U9@sMuMBW zuBbn}jruseUBO$GIqlJrSd{8{O5;(3!@Nl8*PKO0M(~yz^;T=M-grkpH+T28-?w#X zvhwlEhvt;quJ1IZ5mDYVaNoeS_M@430Ob&?Vq2G8RNkDImFa*|F7Ol=s3!RfEgFf^= 6) or - (ansible_os_family == 'Debian' and ansible_distribution_major_version|int >= 8))" - - - name: set status if not in auto-updates - set_fact: auto_updates_status=NA - when: "'auto_updates' not in group_names or - (ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 6) or - (ansible_os_family == 'Debian' and ansible_distribution_major_version|int < 8)" - - ## Debian - # get number of updates and debug - name: (debian) update apt cache if older than 1 day apt: update_cache=yes cache_valid_time=86400 @@ -58,9 +39,9 @@ when: update_cache_result is succeeded - name: (Debian) output - debug: msg="{{ inventory_hostname }};{{ ansible_distribution }};{{ ansible_distribution_major_version }};{{ available_updates.stdout | default('') }};{{ uptime.stdout }};{{ auto_updates_status | default('UNK')}}" + debug: msg="{{ inventory_hostname }};{{ ansible_distribution }};{{ ansible_distribution_major_version }};{{ available_updates.stdout | default('') }};{{ uptime.stdout }}" when: ansible_distribution == "Debian" - name: (Ubuntu) output - debug: msg="{{ inventory_hostname }};{{ ansible_distribution }};{{ ansible_distribution_version }};{{ available_updates.stdout | default('') }};{{ uptime.stdout }};{{ auto_updates_status | default('UNK')}}" + debug: msg="{{ inventory_hostname }};{{ ansible_distribution }};{{ ansible_distribution_version }};{{ available_updates.stdout | default('') }};{{ uptime.stdout }}" when: ansible_distribution == "Ubuntu" diff --git a/ansible/packages.yml b/ansible/playbooks/packages.yml similarity index 89% rename from ansible/packages.yml rename to ansible/playbooks/packages.yml index d0de86a..d6e3c53 100644 --- a/ansible/packages.yml +++ b/ansible/playbooks/packages.yml @@ -9,28 +9,23 @@ - apt - apache2 - bash - - dnsmasq - - exim - - httpd + - check-mk-agent + - elasticsearch - libc-bin - - mailx - make - - mariadb-server - - memcached - mysql-server - - nagios - nginx - - nrpe - openssh-server - php5 - php7.0 - php7.1 - php7.2 - php7.4 - - phpmyadmin - postfix + - proxysql - redis - redis-server + - sphinxsearch - sudo - systemd diff --git a/ansible/packages_include.yml b/ansible/playbooks/packages_include.yml similarity index 100% rename from ansible/packages_include.yml rename to ansible/playbooks/packages_include.yml