Replace podman commands by module

Change-Id: I62814cc874cad88990b3e90da2787107e8c141a1
This commit is contained in:
Sagi Shnaidman 2020-05-07 16:49:23 +03:00
parent 0c0f904ef5
commit a621d89d6a
6 changed files with 81 additions and 24 deletions

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

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

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

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

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

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