Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to newest Digital Ocean modules #229

Closed
w3irdrobot opened this issue Mar 31, 2020 · 13 comments
Closed

Update to newest Digital Ocean modules #229

w3irdrobot opened this issue Mar 31, 2020 · 13 comments

Comments

@w3irdrobot
Copy link

w3irdrobot commented Mar 31, 2020

It appears that Ansible has created a new set of modules that no longer rely on dopy and add more functionality. The current one used in the book will be deprecated in 1.12. It may be beneficial to move to using the newer module(s).

@bodzio4749
Copy link

bodzio4749 commented May 23, 2020

Yeap, I wanted to use my $100 for two months and failed miserably, so I tried to run this project. I failed in that too. The message was about the deprecated module. I guess, Jeff is going to be very busy fixing the code, rewriting the book, and making plans for another Ansible 101 episode. :) In the meantime, I have 8 days to use $87 in credit on DigitalOcean.

@geerlingguy
Copy link
Owner

geerlingguy commented May 24, 2020

@searsaw - Yeah that chapter's on my list soon, after I finish some new work on the Tower/AWX chapter. I've been working my way through the book trying to make notes on examples that need revision/rewrites as I've gone through Ansible 101.

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 25, 2020

There are two examples I need to update:

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 26, 2020

Finished updating the first example. Working on the second.

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 27, 2020

The chapter 9 example is all working... but I'm getting this from the webservers:

Host 104.131.49.132
MySQL Connection (104.131.51.172): FAIL
MySQL Connection (104.131.51.195): FAIL
Memcached Connection: FAIL

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 27, 2020

I can connect to both MySQL servers from the CLI mysql without an issue from the Apache servers... so maybe a PHP issue?

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 27, 2020

So... that was strange: both using PHP on the CLI php index.php and using telnet or mysql on the CLI allowed me to connect to MySQL and Memcached, when run under the root user.

But when I tried loading the web page (via Apache / mod_php), it would not succeed. No errors that I could see or messages in secure log. I disabled SELinux (setenforce 0) and then everything worked... so apparently it was blocking HTTPD and so I had to set:

# setsebool -P httpd_can_network_memcache 1
# setsebool -P httpd_can_network_connect_db 1

Or in Ansible:

    - name: Configure SELinux to allow HTTPD connections.
      seboolean:
        name: "{{ item }}"
        state: true
        persistent: true
      with_items:
        - httpd_can_network_connect_db
        - httpd_can_network_memcache

Testing this now.

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 27, 2020

I got things working, but now replication is not starting on the servers... maybe a bug in my MySQL role?

Host 104.131.38.92
MySQL Connection (104.131.38.165): PASS (slave)
MySQL Connection (104.131.38.206): PASS (slave)
Memcached Connection: PASS

@geerlingguy
Copy link
Owner

geerlingguy commented Jul 27, 2020

Yay after the above fix:

Host 104.131.21.40
MySQL Connection (104.131.21.143): PASS (master)
MySQL Connection (104.131.13.87): PASS (slave)
Memcached Connection: PASS

I also had to use the chomping folded scalar to get rid of a newline character:

mysql_replication_role: >-
  {{ 'master' if (item.1.data.droplet.name == 'a4d.lamp.db.1')
  else 'slave' }}

@AGrowcock
Copy link

AGrowcock commented Apr 28, 2021

So I keep getting the following error when I run the playbook from Chapter 8. The first setup into Digital Ocean.
FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "This size is unavailable."}
I tried changing the size, but keeps failing. Any ideas?

@AGrowcock
Copy link

AGrowcock commented Apr 28, 2021

Found that I had to change the "size: 1gb" to "size: "s-1vcpu-1gb" in the playbook. Also had to troubleshoot the "ssh_keys:" format. May be nice to make a note that they want the ssh fingerprint there.

@geerlingguy
Copy link
Owner

geerlingguy commented Apr 28, 2021

@AGrowcock - What version of the book are you reading currently? Also, what version of Ansible are you running? The API and modules changed a bit in the past year.

@AGrowcock
Copy link

AGrowcock commented Apr 28, 2021

Kindle 2nd Edition. "This version was published on 2020-08-05". Just bought it about 2 months ago.
Ansible Version 2.9.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants