162 lines
4.2 KiB
YAML
162 lines
4.2 KiB
YAML
- 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
|
|
|
|
- name: Generate config files
|
|
config_template:
|
|
src: base.conf.j2
|
|
dest: /tmp/glance-api.conf
|
|
config_overrides: '{{glance_config}}'
|
|
config_type: ini
|
|
|
|
- name: Read configs into memory
|
|
slurp:
|
|
src: "/tmp/httpd-glance-main.conf"
|
|
register: "httpd_glance_main_conf"
|
|
|
|
- name: Read configs into memory
|
|
slurp:
|
|
src: "/tmp/httpd.conf"
|
|
register: "httpd_conf"
|
|
|
|
- name: Read configs into memory
|
|
slurp:
|
|
src: "/tmp/glance-api.conf"
|
|
register: "glance_conf"
|
|
|
|
- name: Create glance configmaps
|
|
ignore_errors: yes
|
|
k8s_v1_config_map:
|
|
host: "{{coe_host}}"
|
|
context: "{{coe_config_context}}"
|
|
kubeconfig: "{{coe_config_file}}"
|
|
name: glance
|
|
namespace: "{{namespace}}"
|
|
state: present
|
|
debug: yes
|
|
labels:
|
|
service: glance
|
|
data:
|
|
config.json: |
|
|
{
|
|
"command": "glance-api --config-file /usr/share/glance/glance-api-dist.conf --config-file /etc/glance/glance-api.conf",
|
|
"config_files": [
|
|
{
|
|
"dest": "/etc/httpd/conf/httpd.conf",
|
|
"owner": "root",
|
|
"perm": "0644",
|
|
"source": "/var/lib/kolla/config_files/httpd.conf"
|
|
},
|
|
{
|
|
"dest": "/etc/glance/glance-api.conf",
|
|
"owner": "glance",
|
|
"perm": "0644",
|
|
"source": "/var/lib/kolla/config_files/glance-api.conf"
|
|
},
|
|
{
|
|
"dest": "/etc/httpd/conf.d/10-glance-main.conf",
|
|
"owner": "root",
|
|
"perm": "0644",
|
|
"source": "/var/lib/kolla/config_files/httpd-glance-main.conf"
|
|
}
|
|
]
|
|
}
|
|
glance-api.conf: |
|
|
{{glance_conf['content'] | b64decode}}
|
|
httpd.conf: |
|
|
{{httpd_conf['content'] | b64decode}}
|
|
httpd-glance-main.conf: |
|
|
{{httpd_glance_main_conf['content'] | b64decode}}
|
|
|
|
- name: Create glance database
|
|
include_role:
|
|
name: ansible-role-k8s-tripleo
|
|
tasks_from: create-database
|
|
vars:
|
|
service_name: 'glance'
|
|
database_name: 'glance'
|
|
|
|
- name: Create glance db-sync job
|
|
k8s_v1_job:
|
|
host: "{{coe_host}}"
|
|
context: "{{coe_config_context}}"
|
|
kubeconfig: "{{coe_config_file}}"
|
|
name: glance-db-sync
|
|
namespace: "{{namespace}}"
|
|
state: present
|
|
restart_policy: OnFailure
|
|
containers:
|
|
- image: tripleoupstream/centos-binary-glance-api
|
|
name: glance-db-sync
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: COPY_ALWAYS
|
|
- name: KOLLA_BOOTSTRAP
|
|
value: ''
|
|
volume_mounts:
|
|
- name: kolla-config
|
|
mountPath: /var/lib/kolla/config_files/
|
|
volumes:
|
|
- name: kolla-config
|
|
config_map:
|
|
name: glance
|
|
state: present
|
|
|
|
- name: Create glance service
|
|
k8s_v1_service:
|
|
host: "{{coe_host}}"
|
|
context: "{{coe_config_context}}"
|
|
kubeconfig: "{{coe_config_file}}"
|
|
name: glance
|
|
namespace: "{{namespace}}"
|
|
state: present
|
|
ports:
|
|
- port: 9292
|
|
name: glance-api
|
|
selector:
|
|
app: glance-api
|
|
|
|
- name: Create glance deployment
|
|
k8s_v1beta1_deployment:
|
|
host: "{{coe_host}}"
|
|
context: "{{coe_config_context}}"
|
|
kubeconfig: "{{coe_config_file}}"
|
|
name: glance-api
|
|
namespace: "{{namespace}}"
|
|
replicas: 1
|
|
spec_revision_history_limit: 3
|
|
spec_template_metadata_labels:
|
|
app: glance-api
|
|
containers:
|
|
- name: glance-api
|
|
image: tripleoupstream/centos-binary-glance-api
|
|
imagePullPolicy: IfNotPresent
|
|
env:
|
|
- name: KOLLA_CONFIG_STRATEGY
|
|
value: COPY_ALWAYS
|
|
- name: KOLLA_KUBERNETES
|
|
value: ""
|
|
ports:
|
|
- name: glance-api
|
|
containerPort: 9292
|
|
volume_mounts:
|
|
- name: kolla-config
|
|
mountPath: /var/lib/kolla/config_files/
|
|
volumes:
|
|
- name: kolla-config
|
|
config_map:
|
|
name: glance
|
|
state: present
|
|
|
|
# NOTE(flaper87): we should do this iff the keystone-secret exists and keystone
|
|
# is enabled. Add checks for each.
|
|
- include: keystone.yml
|