I tried multiple ways but I am not getting error messages while running
playbook in EC2 Linux instances the same playbook throwing error and just
I modified my the playbook.
- name: EC2 instance creation
hosts: localhost
connection: local
gather_facts: flase
vars:
proxy_env:
http_proxy: http://localhost:<port>
https_proxy: http://localhost:<port>
NO_PROXY: 169.254.169.254
tasks:
- sts_assume_role:
role_arn:
"arn:aws:iam::xxxxxxxxxxxxx:role/XXXXXXXXXX_CrossAccount_Role"
role_session_name: "iopec2test"
region: ap-northeast-1
register: assumed_ec2_role
environment: "{{ proxy_env }}"
ignore_unreachable: yes
On Mon, Aug 3, 2020 at 10:18 AM Dick Visser <[email protected]> wrote:
> I think the issue is with how you configure your environment wrt proxies.
> Apparently you need that, but it didn't work, as your error pointed out.
>
> That first command task is probably where you try to set those vars, but
> that won't work.
>
> See
>
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_environment.html
>
>
>
>
> On Mon, 3 Aug 2020 at 04:30, lakshminarayanan R <[email protected]>
> wrote:
>
>> I wrote the playbook for creating a resource on AWS environments, I am
>> using the IAM CrossAccount role for this. I ran the playbook from EC2 Linux
>> instances, it has created the resource on the AWS child account but
>> invoking playbook from Jenkins, I am getting boto3 endpoint issue. I
>> attached my sample playbook for your references.
>>
>> ---
>> - name: EC2 instances creation
>> hosts: localhost
>>
>> tasks:
>> - name: environment settings
>> command: "{{ item }}"
>> with_items:
>> - http_proxy:
>> - https_proxy:
>> - NO_PROXY: 169.254.169.254
>>
>> - sts_assume_role:
>> role_arn: "arn:aws:iam::XXXXXXXX:role/XXXXXXXXXXX_Role"
>> role_session_name: "2test"
>> region: us-east-1
>> register: assumed_ec2_role
>>
>> - ec2_instance:
>> aws_access_key: "{{ assumed_ec2_role.sts_creds.access_key }}"
>> aws_secret_key: "{{ assumed_ec2_role.sts_creds.secret_key }}"
>> security_token: "{{ assumed_ec2_role.sts_creds.session_token }}"
>> name: "cloud-instance"
>> #key_name: "prod-ssh-key"
>> vpc_subnet_id: XXXXXXXXXX-x
>> instance_type: t2.large
>> region: "{{ assumed_ec2_role.region }}"
>> security_group: default
>> network:
>> assign_public_ip: false
>> image_id: XXXXXXXXXXXXXXXXx
>> tags:
>> Environment: Testing
>> Name: cloud_instances
>>
>>
>>
>> On Mon, Aug 3, 2020 at 2:22 AM Dick Visser <[email protected]> wrote:
>>
>>> What playbook are we talking about?
>>> I didn't see any in your email.
>>>
>>> On Sun, 2 Aug 2020 at 13:51, lakshminarayanan R <[email protected]>
>>> wrote:
>>>
>>>> thanks for your reply
>>>>
>>>> Playbook is working fine from Linux box while the trigger playbook from
>>>> Jenkins and getting this error and Jenkins has 22 port open status.
>>>>
>>>> On Sunday, August 2, 2020 at 5:13:55 PM UTC+5:30, vinoth kumar wrote:
>>>>>
>>>>> It’s error 111 connection refused . Check port 22 from controller to
>>>>> target servers .
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun 2. Aug 2020 at 12:37, lakshminarayanan R <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> An exception occurred during task execution. To see the full traceback,
>>>>>> use -vvv. The error was: botocore.exceptions.EndpointConnectionError:
>>>>>> Could not connect to the endpoint URL:
>>>>>> "https://ec2.ap-northeast-1.amazonaws.com/"
>>>>>> fatal: [localhost]: FAILED! => {"changed": false, "module_stderr":
>>>>>> "Traceback (most recent call last):\n File
>>>>>> \"/usr/local/lib/python3.6/site-packages/urllib3/connection.py\", line
>>>>>> 160, in _new_conn\n (self._dns_host, self.port), self.timeout,
>>>>>> **extra_kw\n File
>>>>>> \"/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py\",
>>>>>> line 84, in create_connection\n raise err\n File
>>>>>> \"/usr/local/lib/python3.6/site-packages/urllib3/util/connection.py\",
>>>>>> line 74, in create_connection\n
>>>>>> sock.connect(sa)\nConnectionRefusedError: [Errno 111] Connection refused
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Ansible Project" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>> To view this discussion on the web visit
>>>>>> https://groups.google.com/d/msgid/ansible-project/4cb805a2-78b8-45ae-87f0-60a740ea3146o%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/ansible-project/4cb805a2-78b8-45ae-87f0-60a740ea3146o%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Ansible Project" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/ansible-project/293cf960-355c-48da-abde-f69241ece32bo%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/ansible-project/293cf960-355c-48da-abde-f69241ece32bo%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> Sent from a mobile device - please excuse the brevity, spelling and
>>> punctuation.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Ansible Project" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMJAdToU4YMdRJ5bJnb%2B2iq8rkPBPzQDdTam5P1a0q3WA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwMJAdToU4YMdRJ5bJnb%2B2iq8rkPBPzQDdTam5P1a0q3WA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/CAPe1DD_50-gq1QpK-WNshKXBYpHwLwLYe6gvhatvnVVQPp9%2BDg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/ansible-project/CAPe1DD_50-gq1QpK-WNshKXBYpHwLwLYe6gvhatvnVVQPp9%2BDg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> Sent from a mobile device - please excuse the brevity, spelling and
> punctuation.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAL8fbwMrx6RtRZgPHt0T1VFw9DBq5AF7vLsU57v6_28FkBeQ8g%40mail.gmail.com
> <https://groups.google.com/d/msgid/ansible-project/CAL8fbwMrx6RtRZgPHt0T1VFw9DBq5AF7vLsU57v6_28FkBeQ8g%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAPe1DD9PJKiCcXQ6GbtyE7phXXN47Fb8u9j2hES94pG1H32Jzw%40mail.gmail.com.