---
- name: Install Romana binaries
  # Workaround for S3 issue: Delete binaries first
  file: path="{{ romana_dir }}/bin/{{ item }}" state=absent
  with_items:
    - ipam
    - root
    - tenant
    - topology

- s3: region="{{ region }}" bucket="romana-binaries" object="core/latest/origin/{{ romana_core_branch }}/{{ item }}" dest="{{ romana_dir }}/bin/{{ item }}" mode=get
  with_items:
    - ipam
    - root
    - tenant
    - topology

# Make the files executable
- file: path="{{ romana_dir }}/bin/{{ item }}" mode=0750
  with_items:
    - ipam
    - root
    - tenant
    - topology

- name: Install config file
  template: src="romana.conf.yml" dest="{{ romana_dir }}/etc/romana.conf.yml" mode=0644

- file: path="/home/ubuntu/bin/" mode=0775 state=directory

- name: Install romana tool
  copy: src="../cmd/romana" dest="/home/ubuntu/bin/romana" mode=0775
  

---
- name: Install Romana binaries
  # Workaround for S3 issue: Delete binaries first
  file: path="{{ romana_dir }}/bin/{{ item }}" state=absent
  with_items:
    - ipam
    - root
    - tenant
    - topology

- s3: region="{{ region }}" bucket="romana-binaries" object="core/latest/origin/{{ romana_core_branch }}/{{ item }}" dest="{{ romana_dir }}/bin/{{ item }}" mode=get
  with_items:
    - ipam
    - root
    - tenant
    - topology

# Make the files executable
- file: path="{{ romana_dir }}/bin/{{ item }}" mode=0750
  with_items:
    - ipam
    - root
    - tenant
    - topology

- name: Install config file
  template: src="romana.conf.yml" dest="{{ romana_dir }}/etc/romana.conf.yml" mode=0644

# Make sure the bin directory exists
- file: path="/home/ubuntu/bin/" mode=0775 state=directory
# Ensure the jq tool is installed
- apt: pkg="{{ item }}"
  with_items:
    - jq
  become: true
  become_user: root

- name: Install romana tool
  copy: src="../cmd/romana" dest="/home/ubuntu/bin/romana" mode=0775
  

Make sure the jq command is installed (needed by 'romana' script)
Make sure the jq command is installed (needed by 'romana' script)
