tripleo-ansible/tripleo_ansible/roles/tripleo_podman/molecule/login/prepare.yml
Sagi Shnaidman 44c26353e7 Use podman collection instead of podman* modules
Switch to using Ansible Podman collections, remove all
podman modules from tripleo-ansible.

Change-Id: I8846c8a22e5b39cdfbf68fc7f814a81e4e99901a
2021-06-10 12:19:05 +00:00

85 lines
2.3 KiB
YAML

---
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
- name: Prepare
hosts: all
gather_facts: true
pre_tasks:
- name: set basic user fact
set_fact:
ansible_user: "{{ lookup('env', 'USER') }}"
when:
- ansible_user is undefined
- name: set basic home fact
set_fact:
ansible_user_dir: "{{ lookup('env', 'HOME') }}"
when:
- ansible_user_dir is undefined
roles:
- role: test_deps
tasks:
- name: Disable SELinux
become: true
selinux:
state: disabled
- name: Ensure registry doesn't exist
containers.podman.podman_container:
name: registry
state: absent
- name: Pull ubuntu image
containers.podman.podman_image:
name: ubuntu
tag: 16.04
- name: Create auth directory
file:
state: directory
path: "{{ ansible_user_dir }}/auth"
- name: Create registry
shell: |-
podman tag ubuntu:16.04 localhost:5000/my-ubuntu
podman run --entrypoint htpasswd registry:2.7.0 -Bbn testuser testpassword > {{ ansible_user_dir }}/auth/htpasswd
args:
executable: /bin/bash
- name: Create registry
containers.podman.podman_container:
name: registry
image: "registry:2.7.0"
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
tasks_from: tripleo_podman_install.yml
vars_from: "redhat.yml"