Skip to content

Commit

Permalink
fix playbook
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Aug 23, 2023
1 parent d5a33b8 commit 69aa433
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions services/ansible_openvpn/playbooks/fetch_rpi_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
- name: fetch RPI eth0 mac address
ansible.builtin.shell: /usr/sbin/ifconfig eth0 2>/dev/null|awk '/ether/ {print $2}'|sed 's/://g'
register: rpi_mac
- name: Creates directory
file:
path: {{ destination }}
state: directory
delegate_to: localhost
- name: data synchronization
ansible.posix.synchronize:
mode: 'pull'
Expand Down
10 changes: 9 additions & 1 deletion services/ansible_openvpn/playbooks/parse_to_elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
- name: Execute python script to parse data files and push it to the elastic search instance
hosts: 127.0.0.1
connection: local
vars:
source: '/home/semaphore/data/to_process/'
destination: '/home/semaphore/data/archive/'
tasks:
- name: Install specified python requirements
ansible.builtin.pip:
requirements: scripts_elastic_search/requirements.txt
extra_args: --user
- name: Creates archive directory
file:
path: {{ destination }}
state: directory
delegate_to: localhost
- name: Launch python script from playbook
ansible.builtin.script:
cmd: scripts_elastic_search/openvpn_ansible.py --host https://es01:9200 --json_input_folder /home/semaphore/data/to_process/ --api_key {{ ELASTIC_SEARCH_API_KEY }} --api_key_id {{ ELASTIC_SEARCH_API_KEY_ID }} --json_archive_folder /home/semaphore/data/archive/ -v
cmd: scripts_elastic_search/openvpn_ansible.py --host https://es01:9200 --json_input_folder {{ source }} --api_key {{ ELASTIC_SEARCH_API_KEY }} --api_key_id {{ ELASTIC_SEARCH_API_KEY_ID }} --json_archive_folder {{ destination }} -v
args:
executable: python3
register: result
Expand Down

0 comments on commit 69aa433

Please sign in to comment.