diff --git a/roles/_init/tasks/main.yml b/roles/_init/tasks/main.yml index 485fdfa5f..2a7e3add7 100644 --- a/roles/_init/tasks/main.yml +++ b/roles/_init/tasks/main.yml @@ -3,7 +3,8 @@ ansible.builtin.debug: msg: "Using ce-provision {{ _init.ce_provision_version }}" -# See roles/aws/aws_ec2_autoscale_cluster for lock handling in ASGs. +# @TODO This cannot work for ASGs. +# We will need something central for lock files and it cannot be controller servers because they may be containers. - name: Check for a ce-deploy lock file. ansible.builtin.stat: path: "{{ _init.deploy_lock_file }}" diff --git a/roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml b/roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml index e6abb61fd..77b0e0a11 100644 --- a/roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml +++ b/roles/aws/aws_ec2_autoscale_cluster/tasks/main.yml @@ -1,30 +1,4 @@ --- -# With ASGs the lock behaviour in _init will not work, we need to do it here. -- name: Check for a ce-deploy lock file. - ansible.builtin.stat: - path: "{{ _init.deploy_lock_file }}" - register: _ce_deploy_lock - connection: ssh - run_once: true - when: aws_ec2_autoscale_cluster.type == "ec2" - -- name: Abort if ce-deploy lock file exists. - when: - - _ce_deploy_lock.stat.exists is defined and _ce_deploy_lock.stat.exists - block: - - name: Abort if ce-deploy lock file is found. - ansible.builtin.debug: - msg: "ce-deploy lock file discovered, a deployment is in progress! If this is not the case, login to the affected server and delete the file at {{ _init.deploy_lock_file }}." - - ansible.builtin.meta: end_play - -- name: Set a lock file on each ASG machine. - ansible.builtin.file: - path: "{{ _init.lock_file }}" - state: touch - mode: 0644 - connection: ssh - when: aws_ec2_autoscale_cluster.type == "ec2" - # @todo Do we still need that? Used by AMI and LC, # but probably could simply use the base name. - name: Define unique name for resources. @@ -782,13 +756,3 @@ when: - aws_ec2_autoscale_cluster.route_53.zone is defined - aws_ec2_autoscale_cluster.route_53.zone | length > 0 - -# We only need to remove the lock file if the machines will not be replaced. -- name: Remove the lock file on each ASG machine. - ansible.builtin.file: - path: "{{ _init.lock_file }}" - state: absent - connection: ssh - when: - - aws_ec2_autoscale_cluster.type == "ec2" - - not aws_ec2_autoscale_cluster.asg_refresh