{"@attributes":{"version":"2.0"},"channel":{"title":"DEV Community: Keith Maxwell","description":"The latest articles on DEV Community by Keith Maxwell (@maxwellk).","link":"https:\/\/dev.to\/maxwellk","image":{"url":"https:\/\/media2.dev.to\/dynamic\/image\/width=90,height=90,fit=cover,gravity=auto,format=auto\/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F345691%2Faa4bcad2-b4c7-43a3-af94-7984ecdc220c.jpeg","title":"DEV Community: Keith Maxwell","link":"https:\/\/dev.to\/maxwellk"},"language":"en","item":[{"title":"Using GoLand on Fedora Silverblue","pubDate":"Fri, 10 Apr 2020 20:01:21 +0000","link":"https:\/\/dev.to\/maxwellk\/using-goland-on-fedora-silverblue-2agh","guid":"https:\/\/dev.to\/maxwellk\/using-goland-on-fedora-silverblue-2agh","description":"<p>I could find very little information online about running <a href=\"https:\/\/www.jetbrains.com\/go\/\">JetBrains GoLand<\/a> on Fedora Silverblue. I hope this post will change that. I have tested the instructions below with the latest version, <code>2020.1<\/code> \u2014 <a href=\"https:\/\/www.jetbrains.com\/go\/download\/other.html\">released yesterday<\/a> \u2014 and the previous version <code>2019.3.4<\/code> both on <a href=\"https:\/\/docs.fedoraproject.org\/en-US\/fedora-silverblue\/\">Fedora Silverblue<\/a> 30.<\/p>\n\n<p>Using Fedora Silverblue as a desktop operating system means that \u201cevery installation is identical to every other installation of the same version\u201d. I am a very happy Fedora Silverblue user; last year I gave <a href=\"https:\/\/github.com\/maxwell-k\/20191023-Belfast-Linux-User-Group-Silverblue-talk\">a talk<\/a> explaining why.<\/p>\n\n<h1>\n  \n  \n  Why GoLand?\n<\/h1>\n\n<p>I normally try to use open source rather than proprietary software wherever possible. I am a long term <a href=\"https:\/\/www.vim.org\">vim<\/a> user. Saying that, I also actively try to stay open minded about technology. In the end, I decided to try out GoLand because:<\/p>\n\n<ul>\n<li>it was widely endorsed at <a href=\"https:\/\/www.meetup.com\/Belfast-Gophers\/\">Belfast Gophers<\/a>\n<\/li>\n<li>a lot of people I respect from <a href=\"https:\/\/socratesuk.org\">SoCraTes UK<\/a> are JetBrains fans<\/li>\n<li>a recent coding test \/ interview involved pairing with a developer using another JetBrains product; a bit of exposure to JetBrains can only help in that sort of situation<\/li>\n<li>I've already got a licence, from a Legacy Code Retreat event in 2019; the first year of a GoLand licence <a href=\"https:\/\/www.jetbrains.com\/store\/?fromNavMenu#commercial?billing=yearly\">normally costs<\/a> \u00a3149.00.<\/li>\n<\/ul>\n\n<h1>\n  \n  \n  Installation process\n<\/h1>\n\n<p>On Fedora Silverblue the <a href=\"https:\/\/docs.fedoraproject.org\/en-US\/fedora-silverblue\/technical-information\/#filesystem-layout\">root filesystem<\/a> is immutable although certain mutable directories are made available from <code>\/var<\/code>. On another system I would install into <code>\/opt<\/code>, to follow the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Filesystem_Hierarchy_Standard\">Filesystem Hierarchy Standard<\/a>. On Fedora Silverblue <code>\/opt<\/code> is a symbolic link to <code>\/var\/opt<\/code> so I'll install there. I also add a link to the <code>PATH<\/code>; <code>\/usr\/local\/bin<\/code> is writable via <code>\/var\/usrlocal<\/code> which is mounted at <code>\/usr\/local<\/code>.<br>\n<\/p>\n\n<div class=\"highlight\"><pre class=\"highlight shell\"><code><span class=\"nv\">version<\/span><span class=\"o\">=<\/span>2020.1\n<span class=\"nb\">sudo mkdir<\/span> \/var\/opt\/goland\n<span class=\"nb\">cd<\/span> \/var\/opt\/goland\n<span class=\"nb\">sudo chown<\/span> <span class=\"s2\">\"<\/span><span class=\"nv\">$LOGNAME<\/span><span class=\"s2\">:<\/span><span class=\"nv\">$LOGNAME<\/span><span class=\"s2\">\"<\/span> <span class=\"nb\">.<\/span>\ncurl <span class=\"nt\">-OL<\/span> https:\/\/download.jetbrains.com\/go\/goland-<span class=\"nv\">$version<\/span>.tar.gz\ncurl <span class=\"nt\">-O<\/span> https:\/\/download.jetbrains.com\/go\/goland-<span class=\"nv\">$version<\/span>.tar.gz.sha256\n<span class=\"nb\">sha256sum<\/span> <span class=\"nt\">-c<\/span> goland-<span class=\"nv\">$version<\/span>.tar.gz.sha256\n<span class=\"nb\">tar <\/span>xf goland-<span class=\"nv\">$version<\/span>.tar.gz\n<span class=\"nb\">cd <\/span>GoLand-<span class=\"nv\">$version<\/span>\/bin\n<span class=\"nb\">sudo ln<\/span> <span class=\"nt\">-s<\/span> <span class=\"s2\">\"<\/span><span class=\"nv\">$PWD<\/span><span class=\"s2\">\/goland.sh\"<\/span> \/var\/usrlocal\/bin\n<\/code><\/pre><\/div>\n\n\n\n<p><code>Alt-F2<\/code> then <code>goland.sh\u23ce<\/code> should start GoLand!<\/p>\n\n<p>Next up activate your licence. Then use the UI to download an SDK ( File \u2192 Settings \u2192 GOROOT ); this happens in the background. I chose 1.13.8 to match the <a href=\"https:\/\/pkgs.alpinelinux.org\/package\/edge\/community\/x86_64\/go\">current version in Alpine Linux edge<\/a>. After that I was all set; I started working through \u201cThe Hitchhiker's Guide to GoLand\u201d.<\/p>\n\n<h2>\n  \n  \n  Debugging\n<\/h2>\n\n<p>If you have an issue it might help to see messages printed to a terminal; instead at the same terminal as above try: <code>.\/goland.sh\u23ce<\/code>. At first I was connected via SSH without <code>$DISPLAY<\/code> set properly.<\/p>\n\n<h1>\n  \n  \n  Why did this need a blog post?\n<\/h1>\n\n<p>Fedora Silverblue is an immutable desktop operating system. The recommended methods for running GUI software include Flatpaks and or other containers using <a href=\"https:\/\/github.com\/containers\/toolbox\">toolbox<\/a> or even <a href=\"https:\/\/github.com\/containers\/libpod\">Podman<\/a> directly. It is also possible to layer or install traditionally packaged applications with <code>rpm-ostree<\/code> but that introduces differences between one system and the next.<\/p>\n\n<p>My early research didn't show a straight forward answer. The possibilities I came across included: an <a href=\"https:\/\/hub.docker.com\/r\/rycus86\/goland\/\">unofficial container<\/a>, the official <a href=\"https:\/\/snapcraft.io\/goland\">snap that JetBrains publish<\/a> or even using <a href=\"https:\/\/github.com\/AppImage\/pkg2appimage\/blob\/master\/recipes\/GoLand\">an AppImage<\/a>. <a href=\"https:\/\/youtrack.jetbrains.com\/issue\/GO-7441\">No Flatpak is available<\/a>. Snaps are more common on Ubuntu, on Fedora Silverblue the background service would have to be installed first: either inside a container or as a layer with <code>rpm-ostree<\/code>.<\/p>\n\n<p>I should probably have jumped into trying this out practically more quickly. The JetBrains <a href=\"https:\/\/www.jetbrains.com\/help\/go\/installation-guide.html\">installation guide<\/a> doesn't give much detail about this approach, but the files are clearly linked from the JetBrains <a href=\"https:\/\/www.jetbrains.com\/go\/download\/#section=linux\">Linux download page<\/a>.<\/p>\n\n<p>This isn't the perfect installation method but a set of compromises; one disadvantage is that it doesn't provide a launcher. While I knew there would be compromises, I wanted to:<\/p>\n\n<ol>\n<li>Avoid changing the base Fedora Silverblue system with <code>rpm-ostree<\/code>\n<\/li>\n<li>Avoid a complicated setup that includes manually installed dependencies<\/li>\n<li>Use a supported, official method<\/li>\n<\/ol>\n\n<p>In the end I didn't have to compromise on these three points. The process of writing out and ordering the potential compromises for someone else to follow helped me to prioritise the order in which I investigated options.<\/p>\n\n\n\n\n<p>Installing GoLand under Fedora Silverblue was easier than I expected. I wonder what other surprises I will find now I have GoLand up and running.<\/p>\n\n","category":["go","tooling","jetbrains","fedora"]},{"title":"Actionable output from Ansible 2.11","pubDate":"Fri, 03 Apr 2020 12:42:30 +0000","link":"https:\/\/dev.to\/maxwellk\/actionable-output-from-ansible-2-11-2mo3","guid":"https:\/\/dev.to\/maxwellk\/actionable-output-from-ansible-2-11-2mo3","description":"<div class=\"highlight\"><pre class=\"highlight shell\"><code><span class=\"nv\">ANSIBLE_DISPLAY_SKIPPED_HOSTS<\/span><span class=\"o\">=<\/span>no <span class=\"nv\">ANSIBLE_DISPLAY_OK_HOSTS<\/span><span class=\"o\">=<\/span>no <span class=\"se\">\\<\/span>\n    ansible-playbook <span class=\"nt\">-i<\/span>, site.yaml\n<\/code><\/pre><\/div>\n\n\n\n\n\n\n<p>Though there is more to say than that. This is my first blog on <a href=\"https:\/\/dev.to\">https:\/\/dev.to<\/a> and I've ideas and drafts for many more. I was really encouraged by <a href=\"https:\/\/blog.miguelgrinberg.com\">Miguel Grinberg<\/a>'s <a href=\"https:\/\/github.com\/PyConLimerick\/Limerick2020\/blob\/master\/Abstracts\/09_Grinsberg_Miguel_Python_Community_Engagement.md\">talk<\/a> at <a href=\"https:\/\/python.ie\/pycon-limerick-2020\/\">PyCon Limerick<\/a>. I am pleased to have put a post out into the world.<\/p>\n\n<p>I am a big fan of Ansible and have found the community, especially the documentation team, very welcoming. I've been using Ansible since around version 2.4 which was <a href=\"https:\/\/pypi.org\/project\/ansible\/#history\">released in 2017<\/a>. The current version is 2.9.<\/p>\n\n<p>Ansible 2.7 deprecated a feature for limiting the output of the <code>ansible-playbook<\/code> command line interface (CLI). It is scheduled to be removed in 2.11. This post explains a little context and how to switch over to the new approach.<\/p>\n\n<p>As you may know, deprecation is a process for removing features from software; in Ansible deprecation follows <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/reference_appendices\/release_and_maintenance.html#deprecation-cycle\">a policy<\/a>. This process gives users warnings and an opportunity to move away from the deprecated feature before anything relying on it breaks.<\/p>\n\n\n\n\n<p>Simplifying a little, an Ansible playbook runs a series of tasks against a host. By default the <code>ansible-playbook<\/code> CLI reports back the status from each task. This can be reported as:<\/p>\n\n<ol>\n<li>OK: completed successfully and nothing was changed<\/li>\n<li>Changed: completed successfully with changes<\/li>\n<li>Failed: the task did not complete . Skipped: the task was not run, likely because of a <code>when:<\/code> clause<\/li>\n<\/ol>\n\n<p>Ansible will report a task as unreachable if it cannot contact the host. Further <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/user_guide\/playbooks_error_handling.html#ignoring-failed-commands\">ignored<\/a> and <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/user_guide\/playbooks_blocks.html#block-error-handling\">rescued<\/a> relate to bespoke error handling.<\/p>\n\n<p>Quickly identifying tasks with a changed status is a helpful filter. It is particularly effective if you write <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/reference_appendices\/glossary.html#term-idempotency\">idempotent<\/a> playbooks. Failed tasks are also of interest.<\/p>\n\n<p>If you are tracking configuration as code, for example as Ansible playbooks in a git repository, this filtering makes it easier to marry the system changes reported by Ansible and the configuration changes in git.<\/p>\n\n<p>Before Ansible 2.7 the recommended way to filter output to only show tasks with a changed or failed status was the <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/plugins\/callback\/actionable.html\">actionable<\/a> plugin. In Ansible 2.11 that plugin will be removed.<\/p>\n\n<p>The current approach is to set two options and use the <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/plugins\/callback\/default.html\">default output plugin<\/a>. The two commands below show the old and new approach:<br>\n<\/p>\n\n<div class=\"highlight\"><pre class=\"highlight shell\"><code><span class=\"nv\">ANSIBLE_STDOUT_CALLBACK<\/span><span class=\"o\">=<\/span>actionable ansible-playbook <span class=\"nt\">-i<\/span>, site.yaml\n<span class=\"nv\">ANSIBLE_DISPLAY_SKIPPED_HOSTS<\/span><span class=\"o\">=<\/span>no <span class=\"nv\">ANSIBLE_DISPLAY_OK_HOSTS<\/span><span class=\"o\">=<\/span>no <span class=\"se\">\\<\/span>\n    ansible-playbook <span class=\"nt\">-i<\/span>, site.yaml\n<\/code><\/pre><\/div>\n\n\n\n<p>There are many different ways to set these options; either <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/plugins\/callback.html\">in configuration files<\/a> or environment variables. The change is the same regardless: instead of overriding the <a href=\"https:\/\/docs.ansible.com\/ansible\/latest\/reference_appendices\/config.html#default-stdout-callback\">default callback plugin for standard out<\/a>, <code>stdout_callback=actionable<\/code>, instead set two options on the default callback: <code>display_skipped_hosts=no<\/code> and <code>display_ok_hosts=no<\/code>.<\/p>\n\n<p>For more detail about the background to this change, take a look at the GitHub <a href=\"https:\/\/github.com\/ansible\/ansible\/pull\/41058\">pull request<\/a> and <a href=\"https:\/\/github.com\/ansible\/ansible\/commit\/9c5d40ff152a8a94dc226735ce43593ebbb10104\">commit<\/a> implementing the deprecation.<\/p>\n\n","category":["ansible","devops","git","intro"]}]}}