diff --git a/common/deploy-steps-tasks.yaml b/common/deploy-steps-tasks.yaml index 9627122145..59d011557a 100644 --- a/common/deploy-steps-tasks.yaml +++ b/common/deploy-steps-tasks.yaml @@ -124,10 +124,10 @@ tags: - host_config - # Config file for our docker-puppet.py script, used to generate container configs - - name: Create /var/lib/docker-puppet + # Config file for our container-puppet.py script, used to generate container configs + - name: Create /var/lib/container-puppet file: - path: /var/lib/docker-puppet + path: /var/lib/container-puppet state: directory setype: svirt_sandbox_file_t selevel: s0 @@ -135,18 +135,36 @@ - container_config - container_config_tasks - - name: Delete existing /var/lib/docker-puppet/docker-puppet.sh + # For backward compatibility in Stein, so our operators have time + # to learn about the new directory. + - name: Create /var/lib/docker-puppet for backward compatibility file: - path: /var/lib/docker-puppet/docker-puppet.sh + path: /var/lib/docker-puppet + state: directory + tags: + - container_config + - container_config_tasks + + - name: Deprecation file about /var/lib/docker-puppet + copy: + dest: /var/lib/docker-puppet/readme.txt + content: | + /var/lib/docker-puppet was moved under + /var/lib/container-puppet because we don't run Docker anymore. + ignore_errors: true + + - name: Delete existing /var/lib/container-puppet/container-puppet.sh + file: + path: /var/lib/container-puppet/container-puppet.sh state: absent tags: - container_config ignore_errors: true check_mode: no - - name: Delete existing /var/lib/docker-puppet/check-mode for check mode + - name: Delete existing /var/lib/container-puppet/check-mode for check mode file: - path: /var/lib/docker-puppet/check-mode + path: /var/lib/container-puppet/check-mode state: absent tags: - container_config @@ -155,9 +173,9 @@ when: - ansible_check_mode - - name: Create /var/lib/docker-puppet/check-mode for check mode + - name: Create /var/lib/container-puppet/check-mode for check mode file: - path: /var/lib/docker-puppet/check-mode + path: /var/lib/container-puppet/check-mode state: directory setype: svirt_sandbox_file_t selevel: s0 @@ -167,10 +185,10 @@ when: - ansible_check_mode - - name: Write docker-puppet.json file + - name: Write container-puppet.json file copy: content: "{{ lookup('file', tripleo_role_name + '/puppet_config.yaml', errors='ignore') | default([], True) | from_yaml | to_nice_json }}" - dest: /var/lib/docker-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}docker-puppet.json + dest: /var/lib/container-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}container-puppet.json force: yes mode: '0600' tags: @@ -178,9 +196,9 @@ check_mode: no diff: no - - name: Diff docker-puppet.json changes for check mode + - name: Diff container-puppet.json changes for check mode command: - diff -uN /var/lib/docker-puppet/docker-puppet.json /var/lib/docker-puppet/check-mode/docker-puppet.json + diff -uN /var/lib/container-puppet/container-puppet.json /var/lib/container-puppet/check-mode/container-puppet.json register: diff_results tags: - container_config @@ -191,7 +209,7 @@ failed_when: false changed_when: diff_results.rc == 1 - - name: Diff docker-puppet.json changes for check mode + - name: Diff container-puppet.json changes for check mode debug: var: diff_results.stdout_lines changed_when: diff_results.rc == 1 @@ -399,17 +417,17 @@ ignore_errors: "{{ ansible_check_mode }}" ###################################### - # Generate config via docker-puppet.py + # Generate config via container-puppet.py ###################################### - - name: Run docker-puppet tasks (generate config) during step {{ step }} - shell: "{{ python_cmd }} /var/lib/docker-puppet/docker-puppet.py" + - name: Run container-puppet tasks (generate config) during step {{ step }} + shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py" environment: NET_HOST: 'true' DEBUG: '{{ docker_puppet_debug | bool }}' PROCESS_COUNT: '{{ docker_puppet_process_count }}' CONTAINER_CLI: "{{ container_cli }}" - CONFIG: '/var/lib/docker-puppet/{{ ansible_check_mode | ternary("check-mode/", "") }}docker-puppet.json' + CONFIG: '/var/lib/container-puppet/{{ ansible_check_mode | ternary("check-mode/", "") }}container-puppet.json' CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}' CHECK_MODE: '{{ ansible_check_mode | ternary(1, 0) }}' STARTUP_CONFIG_PATTERN: '/var/lib/tripleo-config/{{ ansible_check_mode | ternary("check-mode/", "") }}docker-container-startup-config-step_*.json' @@ -424,7 +442,7 @@ tags: - container_config - - name: "Debug output for task: Run docker-puppet tasks (generate config) during step {{ step }}" + - name: "Debug output for task: Run container-puppet tasks (generate config) during step {{ step }}" debug: var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([])) when: outputs.rc is defined @@ -433,7 +451,7 @@ - container_config ignore_errors: "{{ ansible_check_mode }}" - - name: Diff docker-puppet.py puppet-generated changes for check mode + - name: Diff container-puppet.py puppet-generated changes for check mode shell: | diff -ruN --no-dereference -q /var/lib/config-data/puppet-generated /var/lib/config-data/check-mode/puppet-generated diff -ruN --no-dereference /var/lib/config-data/puppet-generated /var/lib/config-data/check-mode/puppet-generated @@ -448,7 +466,7 @@ failed_when: false changed_when: diff_results.rc == 1 - - name: Diff docker-puppet.py puppet-generated changes for check mode + - name: Diff container-puppet.py puppet-generated changes for check mode debug: var: diff_results.stdout_lines changed_when: diff_results.rc == 1 @@ -463,7 +481,7 @@ # Per step starting of the containers using paunch ################################################## - # Note docker-puppet.py generates the hashed-*.json file, which is a copy of + # Note container-puppet.py generates the hashed-*.json file, which is a copy of # the *step_n.json with a hash of the generated external config added # This acts as a salt to enable restarting the container if config changes # TODO(cjeanner): add --container-log-path {{ container_log_stdout_path }} once @@ -498,7 +516,7 @@ - name: "Clean docker_puppet_tasks for {{ansible_hostname}} step {{step}}" file: - path: /var/lib/docker-puppet/docker-puppet-tasks{{step}}.json + path: /var/lib/container-puppet/container-puppet-tasks{{step}}.json state: absent tags: - container_config_tasks @@ -513,20 +531,20 @@ tags: - container_config_tasks - - name: Write docker-puppet-tasks json file for {{ansible_hostname}} step {{step}} + - name: Write container-puppet-tasks json file for {{ansible_hostname}} step {{step}} copy: content: "{{host_docker_puppet_tasks|to_nice_json}}" - dest: "/var/lib/docker-puppet/docker-puppet-tasks{{step}}.json" + dest: "/var/lib/container-puppet/container-puppet-tasks{{step}}.json" force: yes mode: '0600' tags: - container_config_tasks when: host_docker_puppet_tasks is defined - - name: Run docker-puppet tasks (bootstrap tasks) for step {{ step }} - shell: "{{ python_cmd }} /var/lib/docker-puppet/docker-puppet.py" + - name: Run container-puppet tasks (bootstrap tasks) for step {{ step }} + shell: "{{ python_cmd }} /var/lib/container-puppet/container-puppet.py" environment: - CONFIG: /var/lib/docker-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}docker-puppet-tasks{{ step }}.json + CONFIG: /var/lib/container-puppet/{{ ansible_check_mode | ternary('check-mode/', '') }}container-puppet-tasks{{ step }}.json CONFIG_VOLUME_PREFIX: '/var/lib/config-data{{ ansible_check_mode | ternary("/check-mode", "") }}' NET_HOST: "true" NO_ARCHIVE: "true" @@ -542,7 +560,7 @@ tags: - container_config_tasks - - name: "Debug output for task: Run docker-puppet tasks (bootstrap tasks) for step {{ step }}" + - name: "Debug output for task: Run container-puppet tasks (bootstrap tasks) for step {{ step }}" debug: var: outputs.stdout_lines | default([]) | union(outputs.stderr_lines | default([])) when: outputs.rc is defined diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 85762ecb3a..a32998a869 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -68,11 +68,11 @@ parameters: DockerPuppetDebug: type: boolean default: false - description: Set to True to enable debug logging with docker-puppet.py + description: Set to True to enable debug logging with container-puppet.py DockerPuppetProcessCount: type: number default: 6 - description: Number of concurrent processes to use when running docker-puppet to generate config files. + description: Number of concurrent processes to use when running container-puppet to generate config files. ContainerCli: type: string default: 'docker' @@ -228,7 +228,7 @@ outputs: deploy_steps_max: {{deploy_steps_max}} ssh_known_hosts: {get_param: ssh_known_hosts_hostnames} common_deploy_steps_tasks: {get_file: deploy-steps-tasks.yaml} - docker_puppet_script: {get_file: ../docker/docker-puppet.py} + docker_puppet_script: {get_file: ../docker/container-puppet.py} deploy_steps_playbook: str_replace: params: @@ -291,10 +291,10 @@ outputs: docker_puppet_process_count: DOCKER_PUPPET_PROCESS_COUNT docker_puppet_mount_host_puppet: DOCKER_PUPPET_MOUNT_HOST_PUPPET tasks: - - name: Create /var/lib/docker-puppet - file: path=/var/lib/docker-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true - - name: Write docker-puppet.py - copy: src=docker_puppet_script.yaml dest=/var/lib/docker-puppet/docker-puppet.py force=yes mode=0600 + - name: Create /var/lib/container-puppet + file: path=/var/lib/container-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true + - name: Write container-puppet.py + copy: src=docker_puppet_script.yaml dest=/var/lib/container-puppet/container-puppet.py force=yes mode=0600 {%- for role in roles %} - import_tasks: {{role.name}}/deploy_steps_tasks.yaml when: tripleo_role_name == '{{role.name}}' @@ -823,10 +823,10 @@ outputs: when: tripleo_role_name == '{{role.name}}' name: Run Fast Forward Upgrade Prep Workarounds for {{role.name}} {%- endfor %} - - name: Create /var/lib/docker-puppet - file: path=/var/lib/docker-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true - - name: Write docker-puppet.py - copy: src=docker_puppet_script.yaml dest=/var/lib/docker-puppet/docker-puppet.py force=yes mode=0600 + - name: Create /var/lib/container-puppet + file: path=/var/lib/container-puppet state=directory setype=svirt_sandbox_file_t selevel=s0 recurse=true + - name: Write container-puppet.py + copy: src=docker_puppet_script.yaml dest=/var/lib/container-puppet/container-puppet.py force=yes mode=0600 - include_tasks: fast_forward_upgrade_prep_role_tasks.yaml with_sequence: start=0 end={{fast_forward_upgrade_prep_steps_max}} loop_control: diff --git a/docker/docker-puppet.py b/docker/container-puppet.py similarity index 97% rename from docker/docker-puppet.py rename to docker/container-puppet.py index 46297ec34d..52e5fb831f 100755 --- a/docker/docker-puppet.py +++ b/docker/container-puppet.py @@ -13,7 +13,7 @@ # under the License. # Shell script tool to run puppet inside of the given container image. -# Uses the config file at /var/lib/docker-puppet/docker-puppet.json as a source for a JSON +# Uses the config file at /var/lib/container-puppet/container-puppet.json as a source for a JSON # array of [config_volume, puppet_tags, manifest, config_image, [volumes]] settings # that can be used to generate config files or run ad-hoc puppet modules # inside of a container. @@ -31,7 +31,7 @@ import multiprocessing from paunch import runner as containers_runner logger = None -sh_script = '/var/lib/docker-puppet/docker-puppet.sh' +sh_script = '/var/lib/container-puppet/container-puppet.sh' container_cli = os.environ.get('CONTAINER_CLI', 'docker') container_log_stdout_path = os.environ.get('CONTAINER_LOG_STDOUT_PATH', '/var/log/containers/stdouts') @@ -57,7 +57,7 @@ def get_logger(): log = get_logger() -log.info('Running docker-puppet') +log.info('Running container-puppet') config_volume_prefix = os.path.abspath(os.environ.get('CONFIG_VOLUME_PREFIX', '/var/lib/config-data')) @@ -70,7 +70,7 @@ if container_cli == 'docker': env = {} # FIXME: add log=log once we have paunch 4.0.1 in Pypi and promoted in RDO RUNNER = containers_runner.DockerRunner( - 'docker-puppet', cont_cmd='docker') + 'container-puppet', cont_cmd='docker') elif container_cli == 'podman': # podman doesn't allow relabeling content in /usr and # doesn't support named volumes @@ -80,7 +80,7 @@ elif container_cli == 'podman': env = {'PATH': os.environ['PATH']} # FIXME: add log=log once we have paunch 4.0.1 in Pypi and promoted in RDO RUNNER = containers_runner.PodmanRunner( - 'docker-puppet', cont_cmd='podman') + 'container-puppet', cont_cmd='podman') else: log.error('Invalid container_cli: %s' % container_cli) sys.exit(1) @@ -189,7 +189,7 @@ def rm_container(name): process_count = int(os.environ.get('PROCESS_COUNT', multiprocessing.cpu_count())) -config_file = os.environ.get('CONFIG', '/var/lib/docker-puppet/docker-puppet.json') +config_file = os.environ.get('CONFIG', '/var/lib/container-puppet/container-puppet.json') log.debug('CONFIG: %s' % config_file) # If specified, only this config_volume will be used config_volume_only = os.environ.get('CONFIG_VOLUME', None) @@ -329,7 +329,7 @@ if not os.path.exists(sh_script): # they need the old password to achieve that. # For those services, we update the config hash to notify # paunch that a restart is needed, but we do not update the - # password file in docker-puppet if the file already existed + # password file in container-puppet if the file already existed # before and let the service regenerate it instead. password_files="/root/.my.cnf" @@ -397,7 +397,7 @@ def mp_puppet_config(*args): man_file.write('include ::tripleo::packages\n') man_file.write(manifest) - uname = RUNNER.unique_container_name('docker-puppet-%s' % + uname = RUNNER.unique_container_name('container-puppet-%s' % config_volume) rm_container(uname) pull_image(config_image) diff --git a/docker/services/README.rst b/docker/services/README.rst index 3969adcbf6..c74b995c8c 100644 --- a/docker/services/README.rst +++ b/docker/services/README.rst @@ -91,10 +91,10 @@ are re-asserted when applying latter ones. this container. * docker_puppet_tasks: This section provides data to drive the - docker-puppet.py tool directly. The task is executed only once + container-puppet.py tool directly. The task is executed only once within the cluster (not on each node) and is useful for several puppet snippets we require for initialization of things like - keystone endpoints, database users, etc. See docker-puppet.py + keystone endpoints, database users, etc. See container-puppet.py for formatting. Docker steps diff --git a/puppet/role.role.j2.yaml b/puppet/role.role.j2.yaml index 5859e4b04a..b35cfdfb27 100644 --- a/puppet/role.role.j2.yaml +++ b/puppet/role.role.j2.yaml @@ -652,7 +652,7 @@ resources: config: hierarchy: - '"%{::uuid}"' - - docker_puppet # Optionally provided by docker-puppet.py + - docker_puppet # Optionally provided by container-puppet.py - heat_config_%{::deploy_config_name} - config_step - {{role.name.lower()}}_extraconfig diff --git a/releasenotes/notes/var_lib_docker_deprec-0c48311c01605228.yaml b/releasenotes/notes/var_lib_docker_deprec-0c48311c01605228.yaml new file mode 100644 index 0000000000..badd44e146 --- /dev/null +++ b/releasenotes/notes/var_lib_docker_deprec-0c48311c01605228.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - | + The /var/lib/docker-puppet is deprecated and can now be found under + /var/lib/container-puppet. We don't have Docker anymore so we try to avoid + confusion in the directories. The directory still exists but a readme + file points to the right directory.