working on profile.d/ansible-venv.sh
This commit is contained in:
+36
-5
@@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
- name: bootstrap
|
- name: bootstrap
|
||||||
hosts: all
|
hosts: all
|
||||||
become: yes
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
- name: Install bootstrap packages
|
- name: Install bootstrap packages
|
||||||
ansible.builtin.apt:
|
ansible.builtin.apt:
|
||||||
|
become: yes
|
||||||
state: latest
|
state: latest
|
||||||
pkg:
|
pkg:
|
||||||
- bash
|
- bash
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
- name: Make sure hpf-sudo group exists
|
- name: Make sure hpf-sudo group exists
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
|
become: yes
|
||||||
name: hpf-sudo
|
name: hpf-sudo
|
||||||
state: present
|
state: present
|
||||||
system: true
|
system: true
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
|
|
||||||
- name: Make sure hpf-sudo-np group exists
|
- name: Make sure hpf-sudo-np group exists
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
|
become: yes
|
||||||
name: hpf-sudo-np
|
name: hpf-sudo-np
|
||||||
state: present
|
state: present
|
||||||
system: true
|
system: true
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
|
|
||||||
- name: Copy over /etc/sudoers.d/hpf
|
- name: Copy over /etc/sudoers.d/hpf
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
become: yes
|
||||||
src: etc_sudoers_d_hpf
|
src: etc_sudoers_d_hpf
|
||||||
dest: /etc/sudoers.d/hpf
|
dest: /etc/sudoers.d/hpf
|
||||||
owner: root
|
owner: root
|
||||||
@@ -62,8 +65,38 @@
|
|||||||
backup: true
|
backup: true
|
||||||
validate: /usr/sbin/visudo -csf %s
|
validate: /usr/sbin/visudo -csf %s
|
||||||
|
|
||||||
|
|
||||||
|
#### .profile.d should be in SKEL directory - look it up
|
||||||
|
|
||||||
|
- name: Make sure .profile.d directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
become: true
|
||||||
|
path: /etc/skel/.profile.d
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rwx,go=
|
||||||
|
|
||||||
|
|
||||||
|
#### ansible-venv.sh should be in SKEL directory - look it up
|
||||||
|
|
||||||
|
- name: Copy over ansible-venv.sh
|
||||||
|
ansible.builtin.copy:
|
||||||
|
become: true
|
||||||
|
src: profile_d_ansible_venv_sh
|
||||||
|
dest: /etc/skel/.profile.d/ansible-pull.sh
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: u=rwx,go=
|
||||||
|
backup: true
|
||||||
|
|
||||||
|
|
||||||
|
#### .profile
|
||||||
|
|
||||||
|
|
||||||
- name: Make sure hpf-ans group exists
|
- name: Make sure hpf-ans group exists
|
||||||
ansible.builtin.group:
|
ansible.builtin.group:
|
||||||
|
become: yes
|
||||||
name: hpf-ans
|
name: hpf-ans
|
||||||
state: present
|
state: present
|
||||||
system: true
|
system: true
|
||||||
@@ -71,6 +104,7 @@
|
|||||||
|
|
||||||
- name: Make sure hpf-ans user exists
|
- name: Make sure hpf-ans user exists
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
become: yes
|
||||||
name: hpf-ans
|
name: hpf-ans
|
||||||
state: present
|
state: present
|
||||||
system: true
|
system: true
|
||||||
@@ -86,14 +120,12 @@
|
|||||||
name: pip
|
name: pip
|
||||||
virtualenv: $HOME/.ansible-venv
|
virtualenv: $HOME/.ansible-venv
|
||||||
extra_args: --upgrade
|
extra_args: --upgrade
|
||||||
become: no
|
|
||||||
|
|
||||||
- name: Install latest version of ansible in .ansible-venv
|
- name: Install latest version of ansible in .ansible-venv
|
||||||
ansible.builtin.pip:
|
ansible.builtin.pip:
|
||||||
name: ansible
|
name: ansible
|
||||||
virtualenv: $HOME/.ansible-venv
|
virtualenv: $HOME/.ansible-venv
|
||||||
extra_args: "--upgrade"
|
extra_args: "--upgrade"
|
||||||
become: no
|
|
||||||
|
|
||||||
- name: Make sure bin directory exists
|
- name: Make sure bin directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@@ -102,7 +134,6 @@
|
|||||||
owner: hpf-ans
|
owner: hpf-ans
|
||||||
group: hpf-ans
|
group: hpf-ans
|
||||||
mode: u=rwx,go=
|
mode: u=rwx,go=
|
||||||
become: no
|
|
||||||
|
|
||||||
- name: Copy over bin/ansible-pull.sh
|
- name: Copy over bin/ansible-pull.sh
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@@ -112,10 +143,10 @@
|
|||||||
group: hpf-ans
|
group: hpf-ans
|
||||||
mode: u=rwx,go=
|
mode: u=rwx,go=
|
||||||
backup: true
|
backup: true
|
||||||
become: no
|
|
||||||
|
|
||||||
- name: Make sure log directory exists
|
- name: Make sure log directory exists
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
become: yes
|
||||||
path: /var/log/ansible-pull.sh
|
path: /var/log/ansible-pull.sh
|
||||||
state: directory
|
state: directory
|
||||||
owner: hpf-ans
|
owner: hpf-ans
|
||||||
|
|||||||
+2
-10
@@ -1,18 +1,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
* create bootstrap, production, development branches
|
* create production, development branches
|
||||||
* have bootstrap.sh get ansible_pull_branch variable value
|
* have bootstrap.sh get ansible_pull_branch variable value
|
||||||
|
|
||||||
* have the following appended to .profile
|
* have bootstrap.yml use ansible.builtin.blockinfile to maintain /etc/skel/.profile
|
||||||
if [ -d "$HOME/.profile.d" ] ; then
|
|
||||||
for profile_script in $HOME/.profile.d/*.sh ; do
|
|
||||||
. "${profile_script}"
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
* create ~/.profile.d
|
|
||||||
* create ~/.profile.d/ansible-venv.sh
|
|
||||||
ansible.builtin.blockinfile
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user