Commit 4d8869ac authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

playbook: don't remove slapos user until netadmin is in sudoers

parent fa36a275
......@@ -41,8 +41,6 @@
- include: network.yml
- include: hostname.yml
- include: user.yml
- include: sudo.yml
when: is_playbook_ok in [False, "False"]
- include: ssh.yml
- name: Enable hotplugged CPU and Memory automatically
......
---
- name: Ensure sudo is installed
apt: name=sudo state=latest update_cache=yes cache_valid_time=86400
when: ansible_os_family == "Debian"
- include: ../../yum/tasks/main.yml name=sudo cache_valid_time=86400
when: ansible_os_family == "RedHat"
- name: Ensure /etc/sudoers.d directory is present
file: path=/etc/sudoers.d state=directory
- name: Ensure /etc/sudoers.d is scanned by sudo
action: lineinfile dest=/etc/sudoers regexp="#includedir\s+/etc/sudoers.d" line="#includedir /etc/sudoers.d"
- name: Add hadoop user to the sudoers
lineinfile: dest=/etc/sudoers.d/netadmin state=present create=yes regexp="netadmin .*" line="netadmin ALL=(root) NOPASSWD:ALL"
- name: Ensure /etc/sudoers.d/netadmin file has correct permissions
action: file path=/etc/sudoers.d/netadmin mode=0440 state=file owner=root group=root
......@@ -3,6 +3,25 @@
- name: create netadmin
user: name=netadmin shell=/bin/bash groups=root password=$6$rounds=100000$RcjiHRBJa/ORaqst$0L2hFmL5kwGpP6sY2r.hENK3DR5YLdlSDf.r57hwsLjKioYx36CdeLso.52av1UA61rhWIJWdoRYI5bFz.RAC1 update_password=on_create
- name: Ensure sudo is installed
apt: name=sudo state=latest update_cache=yes cache_valid_time=86400
when: ansible_os_family == "Debian"
- include: ../../yum/tasks/main.yml name=sudo cache_valid_time=86400
when: ansible_os_family == "RedHat"
- name: Ensure /etc/sudoers.d directory is present
file: path=/etc/sudoers.d state=directory
- name: Ensure /etc/sudoers.d is scanned by sudo
action: lineinfile dest=/etc/sudoers regexp="#includedir\s+/etc/sudoers.d" line="#includedir /etc/sudoers.d"
- name: Add netadmin user to the sudoers
lineinfile: dest=/etc/sudoers.d/netadmin state=present create=yes regexp="netadmin .*" line="netadmin ALL=(root) NOPASSWD:ALL"
- name: Ensure /etc/sudoers.d/netadmin file has correct permissions
action: file path=/etc/sudoers.d/netadmin mode=0440 state=file owner=root group=root
- name: remove other unwanted users
user: name={{ item }} state=absent
with_items:
......
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