ansible-for-devops icon indicating copy to clipboard operation
ansible-for-devops copied to clipboard

Chapter 10: Provisioning of Rails app fails

Open c3er opened this issue 4 years ago • 3 comments

If I try the example Vagrantfile of the Rails deployment example, it fails at the task "geerlingguy.passenger : Add Phusion apt repo." with the message "apt cache update failed".

Below, an excerpt of the Vagrant/Ansible output. vagrant up failed with the same error before. This excerpt also includes a deprecation warning for the task "geerlingguy.nodejs : Add npm_config_prefix bin directory to global $PATH".

$ vagrant provision

[...]

TASK [geerlingguy.nodejs : Add npm_config_prefix bin directory to global $PATH.] ***
[DEPRECATION WARNING]: evaluating 'nodejs_generate_etc_profile' as a bare 
variable, this behaviour will go away and you might need to add |bool to the 
expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle. 
This feature will be removed in version 2.12. Deprecation warnings can be 
disabled by setting deprecation_warnings=False in ansible.cfg.
ok: [default]

[...]

TASK [geerlingguy.passenger : Add Passenger apt key.] **************************
ok: [default]

TASK [geerlingguy.passenger : Add apt HTTPS capabilities.] *********************
ok: [default]

TASK [geerlingguy.passenger : Add Phusion apt repo.] ***************************
fatal: [default]: FAILED! => {"changed": false, "msg": "apt cache update failed"}

PLAY RECAP *********************************************************************
default                    : ok=24   changed=0    unreachable=0    failed=1    skipped=30   rescued=0    ignored=0   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

My operating system is Ubuntu 20.04 My VirtualBox version is Version 6.1.26

c3er avatar Dec 13 '21 13:12 c3er

I had the same problem.

See also the issue Keyserver Timeout for the Ansible role geerlingguy.passenger.

I have therefore made the following local changes to the geerlingguy.passenger role:

# Passenger repository setup.
- name: Add Passenger apt key.
  apt_key:
    keyserver: hkp://keyserver.ubuntu.com:80
    id: 561F9B9CAC40B2F7
    state: present

- name: Update ca-certificates package.
  apt: name=ca-certificates state=latest update_cache=yes

- name: Add apt HTTPS capabilities.
  apt: name=apt-transport-https state=present

After modifying the keyserver and adding the task to update the ca-certificates package, it worked again.

matmartin avatar Jan 03 '22 09:01 matmartin

I'm going to be working on this example a little bit today, too...

geerlingguy avatar Apr 15 '22 19:04 geerlingguy

Gah... fix one thing, two others break.

rake aborted!
NoMethodError: undefined method `new' for BigDecimal:Class
/opt/demo-rails-app/vendor/bundle/ruby/2.7.0/gems/activesupport-4.2.11/lib/active_support/core_ext/object/duplicable.rb:111

I'm going to have to work on revamping the entire https://github.com/geerlingguy/demo-rails-app setup again, for Ruby 2.7.x (or maybe redo it entirely for the latest versions of Ruby and Rails...), because trying to get the dependency chain working with a demo app that has multiple versions and each version has a Gemfile.lock tied to a specific Ruby/Bundler version... it's definitely a new form of dependency hell :P

For now I'm going to leave the example mostly intact, but still bump the Ruby version I install in the example. I'll have to revisit this example so CI can pass again, but for now I'm going to pause the CI testing for this playbook example :(

geerlingguy avatar Apr 15 '22 20:04 geerlingguy