summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles/prepare-nexus/tasks/main.yml
blob: 951bc28e27eb275a3cd4ec8a284dddd0a1de8833 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
- name: Add nexus simulation hosts to /etc/hosts
  lineinfile:
    regexp: "^{{ ansible_default_ipv4.address | regex_escape() }} {{ etc_hosts | join(' ') | regex_escape() }}$"
    line: "{{ ansible_default_ipv4.address }} {{ etc_hosts | join(' ') }}"
    insertafter: EOF
    path: /etc/hosts
    unsafe_writes: true

- name: "Create needed dirs for nexus role"
  file:
    path: "{{ item }}"
    state: directory
    mode: "u+rw,g+wx,o+rwx"
    recurse: true
  loop:
    - "{{ app_data_path }}/nexus_data"
    - "{{ infra_images_path }}"
    - "{{ aux_data_path }}"

- name: Download and archive docker images for the nexus role to use
  delegate_to: localhost
  docker_image:
    name: "{{ item.name }}"
    tag: "{{ item.tag | default('latest') }}"  # Tag given in 'name' has precedence over the one declared here
    archive_path: "{{ item.archive_path }}"
  loop: "{{ prepare_nexus_images }}"

- name: Copy docker images to node
  copy:
    src: "{{ item.archive_path }}"
    dest: "{{ item.dest }}"
  loop: "{{ prepare_nexus_images }}"