feature: add install ioc ansible playbook
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
[defaults]
|
||||
remote_tmp = /tmp/ansible-$USER
|
||||
@@ -0,0 +1,3 @@
|
||||
all:
|
||||
hosts:
|
||||
sls-lc
|
||||
@@ -0,0 +1,43 @@
|
||||
- name: Install an IOC
|
||||
# TODO: dev/prod
|
||||
hosts: sls-lc
|
||||
gather_facts: false
|
||||
|
||||
#TODO: docs?
|
||||
# For the git clone and git push commands to work smoothly inside this playbook,
|
||||
# ensure your shell environment is passing your SSH key. Run ssh-add -l on your
|
||||
# terminal before firing up ansible-playbook.
|
||||
|
||||
# TODO
|
||||
# If the machine executing this playbook doesn't have a global Git user configured,
|
||||
# the git commit task will fail. You can explicitly bypass this by adding environment
|
||||
# variables directly to the commit task if needed:
|
||||
# environment:
|
||||
# GIT_COMMITTER_NAME: "Ansible Provisioner"
|
||||
# GIT_COMMITTER_EMAIL: "your-email@psi.ch"
|
||||
# GIT_AUTHOR_NAME: "Ansible Provisioner"
|
||||
# GIT_AUTHOR_EMAIL: "your-email@psi.ch"
|
||||
|
||||
|
||||
# TODO: checkout repo, cd to services/<svc>/ioc, 'ioc install -V --ioc AGEBD-CPCL-<SVC> –clean'
|
||||
vars:
|
||||
- workspace_dir: "/tmp/hla_framework_bd"
|
||||
- service_id: "{{ service_id }}"
|
||||
- service_name_lower: "{{ service_name_lower }}"
|
||||
- service_name_upper: "{{ service_name_upper }}"
|
||||
|
||||
|
||||
tasks:
|
||||
- name: Clone this repository
|
||||
ansible.builtin.git:
|
||||
repo: "git@gitea.psi.ch:sls/hla_framework_bd.git"
|
||||
dest: "{{ workspace_dir }}"
|
||||
version: main
|
||||
accept_hostkey: true
|
||||
|
||||
- name: Run ioc install
|
||||
ansible.builtin.shell:
|
||||
# TODO: prod/dev
|
||||
cmd: "ioc install -V --facility sls --ioc AGEBD-CPCL-{{ service_name_upper }}-DEV --clean"
|
||||
chdir: "{{ workspace_dir }}/services/{{ service_id }}-{{ service_name_lower }}/ioc"
|
||||
changed_when: true
|
||||
@@ -0,0 +1,10 @@
|
||||
# Ansible
|
||||
|
||||
## Running a playbook manually
|
||||
|
||||
Set vars on command line:
|
||||
|
||||
```
|
||||
cd ansible
|
||||
ansible-playbook install-ioc.yml -i hosts.yml --extra-vars="service_id=000 service_name_lower=master service_name_upper=MASTER"
|
||||
```
|
||||
Reference in New Issue
Block a user