docker: add logging(source & groups)
[apex-tripleo-heat-templates.git] / docker / services / neutron-dhcp.yaml
1 heat_template_version: pike
2
3 description: >
4   OpenStack containerized Neutron DHCP service
5
6 parameters:
7   DockerNeutronDHCPImage:
8     description: image
9     type: string
10   DockerNeutronConfigImage:
11     description: The container image to use for the neutron config_volume
12     type: string
13   EndpointMap:
14     default: {}
15     description: Mapping of service endpoint -> protocol. Typically set
16                  via parameter_defaults in the resource registry.
17     type: json
18   ServiceData:
19     default: {}
20     description: Dictionary packing service data
21     type: json
22   ServiceNetMap:
23     default: {}
24     description: Mapping of service_name -> network name. Typically set
25                  via parameter_defaults in the resource registry.  This
26                  mapping overrides those in ServiceNetMapDefaults.
27     type: json
28   DefaultPasswords:
29     default: {}
30     type: json
31   RoleName:
32     default: ''
33     description: Role name on which the service is applied
34     type: string
35   RoleParameters:
36     default: {}
37     description: Parameters specific to the role
38     type: json
39
40 resources:
41
42   ContainersCommon:
43     type: ./containers-common.yaml
44
45   NeutronBase:
46     type: ../../puppet/services/neutron-dhcp.yaml
47     properties:
48       EndpointMap: {get_param: EndpointMap}
49       ServiceData: {get_param: ServiceData}
50       ServiceNetMap: {get_param: ServiceNetMap}
51       DefaultPasswords: {get_param: DefaultPasswords}
52       RoleName: {get_param: RoleName}
53       RoleParameters: {get_param: RoleParameters}
54
55 outputs:
56   role_data:
57     description: Role data for the Neutron DHCP role.
58     value:
59       service_name: {get_attr: [NeutronBase, role_data, service_name]}
60       config_settings:
61         map_merge:
62           - get_attr: [NeutronBase, role_data, config_settings]
63       logging_source: {get_attr: [NeutronBase, role_data, logging_source]}
64       logging_groups: {get_attr: [NeutronBase, role_data, logging_groups]}
65       step_config: &step_config
66         get_attr: [NeutronBase, role_data, step_config]
67       service_config_settings: {get_attr: [NeutronBase, role_data, service_config_settings]}
68       # BEGIN DOCKER SETTINGS
69       puppet_config:
70         config_volume: neutron
71         puppet_tags: neutron_config,neutron_dhcp_agent_config
72         step_config: *step_config
73         config_image: {get_param: DockerNeutronConfigImage}
74       kolla_config:
75         /var/lib/kolla/config_files/neutron_dhcp.json:
76           command: /usr/bin/neutron-dhcp-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/dhcp_agent.ini --log-file /var/log/neutron/dhcp-agent.log --config-dir /etc/neutron/conf.d/common --config-dir /etc/neutron/conf.d/neutron-dhcp-agent
77           config_files:
78             - source: "/var/lib/kolla/config_files/src/*"
79               dest: "/"
80               merge: true
81               preserve_properties: true
82           permissions:
83             - path: /var/log/neutron
84               owner: neutron:neutron
85               recurse: true
86             - path: /var/lib/neutron
87               owner: neutron:neutron
88               recurse: true
89       docker_config:
90         step_4:
91           neutron_dhcp:
92             image: {get_param: DockerNeutronDHCPImage}
93             net: host
94             pid: host
95             privileged: true
96             restart: always
97             volumes:
98               list_concat:
99                 - {get_attr: [ContainersCommon, volumes]}
100                 -
101                   - /var/lib/kolla/config_files/neutron_dhcp.json:/var/lib/kolla/config_files/config.json:ro
102                   - /var/lib/config-data/puppet-generated/neutron/:/var/lib/kolla/config_files/src:ro
103                   - /lib/modules:/lib/modules:ro
104                   - /run/:/run
105                   - /var/lib/neutron:/var/lib/neutron
106                   - /var/log/containers/neutron:/var/log/neutron
107             environment:
108               - KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
109       host_prep_tasks:
110         - name: create /var/lib/neutron
111           file:
112             path: /var/lib/neutron
113             state: directory
114         - name: create persistent logs directory
115           file:
116             path: /var/log/containers/neutron
117             state: directory
118       upgrade_tasks:
119         - name: Check if neutron_dhcp_agent is deployed
120           command: systemctl is-enabled neutron-dhcp-agent
121           tags: common
122           ignore_errors: True
123           register: neutron_dhcp_agent_enabled
124         - name: "PreUpgrade step0,validation: Check service neutron-dhcp-agent is running"
125           shell: /usr/bin/systemctl show 'neutron-dhcp-agent' --property ActiveState | grep '\bactive\b'
126           when: neutron_dhcp_agent_enabled.rc == 0
127           tags: step0,validation
128         - name: Stop and disable neutron_dhcp service
129           tags: step2
130           when: neutron_dhcp_agent_enabled.rc == 0
131           service: name=neutron-dhcp-agent state=stopped enabled=no