Compare commits
2 Commits
f2661aaf02
...
9f1db4076f
| Author | SHA256 | Date | |
|---|---|---|---|
| 9f1db4076f | |||
| da8db08d78 |
+2
-3
@@ -25,7 +25,7 @@
|
||||
TIMESTAMP="$(date "+%Y%m%d%H%M%S")"
|
||||
|
||||
GIT_REPO_BASE="https://gitea.admin-a.hpetersenfamily.com/heath/ansible"
|
||||
GIT_REPO="${GIT_REPO_BASE}.git"
|
||||
#GIT_REPO="${GIT_REPO_BASE}.git"
|
||||
GIT_REPO_BRANCH="${1:-"development"}"
|
||||
|
||||
GIT_REPO_FILES="${GIT_REPO_BASE}/raw/branch/${GIT_REPO_BRANCH}/files"
|
||||
@@ -45,7 +45,6 @@ SKEL_ansible_venv_sh="${SKEL_profile_d}/ansible-venv.sh"
|
||||
SKEL_profile="${SKEL}/.profile"
|
||||
|
||||
HPF_ANS_ansible_venv_dir="\${HOME}/.ansible-venv"
|
||||
HPF_ANS_activate="${HPF_ANS_ansible_venv_dir}/bin/activate"
|
||||
|
||||
HPF_ANS_bin="\${HOME}/bin"
|
||||
HPF_ANS_ansible_pull_sh="${HPF_ANS_bin}/ansible-pull.sh"
|
||||
@@ -111,7 +110,7 @@ as_hpf_ans () {
|
||||
#
|
||||
|
||||
# Make sure we're running as root
|
||||
if [ $(id -u) -ne 0 ] ; then
|
||||
if [ "$(id -u)" -ne 0 ] ; then
|
||||
echo "ERROR - Not running as root" >&2
|
||||
exit 100
|
||||
fi
|
||||
|
||||
+36
-5
@@ -23,12 +23,12 @@
|
||||
|
||||
- name: bootstrap
|
||||
hosts: all
|
||||
become: yes
|
||||
|
||||
tasks:
|
||||
|
||||
- name: Install bootstrap packages
|
||||
ansible.builtin.apt:
|
||||
become: yes
|
||||
state: latest
|
||||
pkg:
|
||||
- bash
|
||||
@@ -40,6 +40,7 @@
|
||||
|
||||
- name: Make sure hpf-sudo group exists
|
||||
ansible.builtin.group:
|
||||
become: yes
|
||||
name: hpf-sudo
|
||||
state: present
|
||||
system: true
|
||||
@@ -47,6 +48,7 @@
|
||||
|
||||
- name: Make sure hpf-sudo-np group exists
|
||||
ansible.builtin.group:
|
||||
become: yes
|
||||
name: hpf-sudo-np
|
||||
state: present
|
||||
system: true
|
||||
@@ -54,6 +56,7 @@
|
||||
|
||||
- name: Copy over /etc/sudoers.d/hpf
|
||||
ansible.builtin.copy:
|
||||
become: yes
|
||||
src: etc_sudoers_d_hpf
|
||||
dest: /etc/sudoers.d/hpf
|
||||
owner: root
|
||||
@@ -62,8 +65,38 @@
|
||||
backup: true
|
||||
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
|
||||
ansible.builtin.group:
|
||||
become: yes
|
||||
name: hpf-ans
|
||||
state: present
|
||||
system: true
|
||||
@@ -71,6 +104,7 @@
|
||||
|
||||
- name: Make sure hpf-ans user exists
|
||||
ansible.builtin.user:
|
||||
become: yes
|
||||
name: hpf-ans
|
||||
state: present
|
||||
system: true
|
||||
@@ -86,14 +120,12 @@
|
||||
name: pip
|
||||
virtualenv: $HOME/.ansible-venv
|
||||
extra_args: --upgrade
|
||||
become: no
|
||||
|
||||
- name: Install latest version of ansible in .ansible-venv
|
||||
ansible.builtin.pip:
|
||||
name: ansible
|
||||
virtualenv: $HOME/.ansible-venv
|
||||
extra_args: "--upgrade"
|
||||
become: no
|
||||
|
||||
- name: Make sure bin directory exists
|
||||
ansible.builtin.file:
|
||||
@@ -102,7 +134,6 @@
|
||||
owner: hpf-ans
|
||||
group: hpf-ans
|
||||
mode: u=rwx,go=
|
||||
become: no
|
||||
|
||||
- name: Copy over bin/ansible-pull.sh
|
||||
ansible.builtin.copy:
|
||||
@@ -112,10 +143,10 @@
|
||||
group: hpf-ans
|
||||
mode: u=rwx,go=
|
||||
backup: true
|
||||
become: no
|
||||
|
||||
- name: Make sure log directory exists
|
||||
ansible.builtin.file:
|
||||
become: yes
|
||||
path: /var/log/ansible-pull.sh
|
||||
state: directory
|
||||
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 the following appended to .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
|
||||
* have bootstrap.yml use ansible.builtin.blockinfile to maintain /etc/skel/.profile
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user