ansible-role-k8s-cookiecutter/ansible-role-k8s-{{cookiecu.../tasks/provision.yml

77 lines
2.5 KiB
YAML

{%raw%}
# NOTE(flaper87): If any extra config files are required, it's possibled to
# "upload" them at this point. These files will be copied in the `/tmp` of the
# server (or container) where this role is running.
#- name: Upload config files
# template:
# src: "{{item}}"
# dest: /tmp/{{item}}
# backup: yes
# mode: 0644
# with_items:
# - httpd.conf
# - httpd-glance-main.conf
- include: hiera.yml
{%endraw%}
- name: Generate config files
config_template:
src: base.conf.j2
dest: /tmp/{{cookiecutter.service_name}}.conf
config_overrides: '{%raw%}{{{%endraw%}{{cookiecutter.service_name}}_config}}'
config_type: ini
# NOTE(flaper87): If external config fines were generated, copy them into memory
# following the example below. The registered variable will be used to create
# the config map.
- name: Read configs into memory
slurp:
src: "/tmp/{{cookiecutter.service_name}}.conf"
register: "{{cookiecutter.service_name}}_conf"
- name: Create {{cookiecutter.service_name}} configmaps{%raw%}
ignore_errors: yes
k8s_v1_config_map:
host: "{{coe_host}}"
context: "{{coe_config_context}}"
kubeconfig: "{{coe_config_file}}"{%endraw%}
name: {{cookiecutter.service_name}}{%raw%}
namespace: "{{namespace}}"
state: present
debug: yes
labels:{%endraw%}
service: {{cookiecutter.service_name}}
data:
config.json: |
{
# TODO: Specify the command to use to run the service.
"command": "",
"config_files": [
{
"dest": "/etc/{{cookiecutter.service_name}}/{{cookiecutter.service_name}}.conf",
"owner": "{{cookiecutter.service_name}}",
"perm": "0644",
"source": "/var/lib/kolla/config_files/{{cookiecutter.service_name}}.conf"
}
]
}
{{cookiecutter.service_name}}.conf: |
{%raw%}{{{%endraw%}{{cookiecutter.service_name}}_conf['content'] | b64decode}}
- name: Create {{cookiecutter.service_name}} database
include_role:
name: ansible-role-k8s-tripleo
tasks_from: create-database
vars:
service_name: '{{cookiecutter.service_name}}'
database_name: '{{cookiecutter.service_name}}'
# NOTE(flaper87): Here you'll create jobs for db-sync, service bootstrap. Create
# deployments for the various services, a kubernetes service if an API is being
# exposed, etc.
# NOTE(flaper87): we should do this iff the keystone-secret exists and keystone
# is enabled. Add checks for each.
- include: keystone.yml