Browse Source

Replace podman commands by module

Change-Id: I62814cc874cad88990b3e90da2787107e8c141a1
tags/1.4.0
Sagi Shnaidman 2 months ago
parent
commit
a621d89d6a
6 changed files with 81 additions and 24 deletions
  1. +9
    -2
      tripleo_ansible/roles/tripleo_container_rm/molecule/default/prepare.yml
  2. +9
    -2
      tripleo_ansible/roles/tripleo_container_rm/molecule/legacy_vars/prepare.yml
  3. +12
    -3
      tripleo_ansible/roles/tripleo_container_rm/molecule/podman-rm-stopped/prepare.yml
  4. +9
    -2
      tripleo_ansible/roles/tripleo_container_stop/molecule/default/prepare.yml
  5. +11
    -5
      tripleo_ansible/roles/tripleo_keystone_resources/molecule/default/prepare.yml
  6. +31
    -10
      tripleo_ansible/roles/tripleo_podman/molecule/login/prepare.yml

+ 9
- 2
tripleo_ansible/roles/tripleo_container_rm/molecule/default/prepare.yml View File

@@ -32,10 +32,17 @@
state: latest

- name: Pull container image
command: "podman pull fedora"
podman_image:
name: fedora

- name: Create test containers
command: "podman run -itd --systemd true --name {{ item }} fedora bash"
podman_container:
name: "{{ item }}"
interactive: true
tty: true
detach: true
image: fedora
command: bash
with_items:
- podman-container1
- podman-container2

+ 9
- 2
tripleo_ansible/roles/tripleo_container_rm/molecule/legacy_vars/prepare.yml View File

@@ -32,10 +32,17 @@
state: latest

- name: Pull container image
command: "podman pull fedora"
podman_image:
name: fedora

- name: Create test containers
command: "podman run -itd --systemd true --name {{ item }} fedora bash"
podman_container:
name: "{{ item }}"
interactive: true
tty: true
detach: true
image: fedora
command: bash
with_items:
- podman-legacy-container1
- podman-legacy-container2

+ 12
- 3
tripleo_ansible/roles/tripleo_container_rm/molecule/podman-rm-stopped/prepare.yml View File

@@ -32,16 +32,25 @@
state: latest

- name: Pull container image
command: "podman pull fedora"
podman_image:
name: fedora

- name: Create test containers
command: "podman run -itd --systemd true --name {{ item }} fedora bash"
podman_container:
name: "{{ item }}"
interactive: true
tty: true
detach: true
image: fedora
command: bash
with_items:
- podman-container1
- podman-container2

- name: Stop test containers
command: "podman stop {{ item }}"
podman_container:
name: "{{ item }}"
state: stopped
with_items:
- podman-container1
- podman-container2

+ 9
- 2
tripleo_ansible/roles/tripleo_container_stop/molecule/default/prepare.yml View File

@@ -32,10 +32,17 @@
state: latest

- name: Pull container image
command: "podman pull fedora"
podman_image:
name: fedora

- name: Create test containers
command: "podman run -itd --systemd true --name {{ item }} fedora bash"
podman_container:
name: "{{ item }}"
interactive: true
tty: true
detach: true
image: fedora
command: bash
with_items:
- podman-container1
- podman-container2

+ 11
- 5
tripleo_ansible/roles/tripleo_keystone_resources/molecule/default/prepare.yml View File

@@ -38,9 +38,15 @@
shell: "podman build -t keystone-img -f {{ playbook_dir }}/Dockerfile.keystone ."
become: false

- name: Run keystone container
shell: |-
podman rm --force keystone-podman || true
podman run -d -p 5000:5000 --name keystone-podman keystone-img
sleep 30
- name: Create test containers
podman_container:
name: keystone-podman
image: keystone-img
detach: true
ports:
- "5000:5000"
become: false

- name: Give keystone time to go up
pause:
seconds: 30

+ 31
- 10
tripleo_ansible/roles/tripleo_podman/molecule/login/prepare.yml View File

@@ -35,23 +35,44 @@
- role: test_deps

tasks:

- name: Ensure registry doesn't exist
podman_container:
name: registry
state: absent

- name: Pull ubuntu image
podman_image:
name: ubuntu
tag: 16.04

- name: Create auth directory
file:
state: directory
path: "{{ ansible_user_dir }}/auth"

- name: Create registry
shell: |-
podman container rm --force registry || true
podman pull ubuntu:16.04
podman tag ubuntu:16.04 localhost:5000/my-ubuntu
mkdir -p {{ ansible_user_dir }}/auth
podman run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > {{ ansible_user_dir }}/auth/htpasswd
podman run -d -p 5000:5000 --restart=always \
--name registry \
-v "{{ ansible_user_dir }}/auth:/auth" \
-e "REGISTRY_AUTH=htpasswd" \
-e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
registry:2
args:
executable: /bin/bash

- name: Create registry
podman_container:
name: registry
image: "registry:2"
restart_policy: always
detach: true
ports:
- "5000:5000"
volume:
- "{{ ansible_user_dir }}/auth:/auth"
env:
REGISTRY_AUTH: "htpasswd"
REGISTRY_AUTH_HTPASSWD_REALM: "Registry Realm"
REGISTRY_AUTH_HTPASSWD_PATH: "/auth/htpasswd"

- name: Run install
include_role:
name: tripleo_podman


Loading…
Cancel
Save